Class UnusedLocalVariableCheck.VariableDesc

java.lang.Object
com.puppycrawl.tools.checkstyle.checks.coding.UnusedLocalVariableCheck.VariableDesc
Enclosing class:
UnusedLocalVariableCheck

private static final class UnusedLocalVariableCheck.VariableDesc extends Object
Maintains information about the variable.
  • Field Details

  • Constructor Details

  • Method Details

    • getName

      public String getName()
      Get the name of variable.
      Returns:
      name of variable
    • getTypeAst

      public DetailAST getTypeAst()
      Get the associated ast node of type TokenTypes.TYPE.
      Returns:
      the associated ast node of type TokenTypes.TYPE
    • getScope

      public DetailAST getScope()
      Get ast of type TokenTypes.SLIST or TokenTypes.LITERAL_FOR or TokenTypes.OBJBLOCK which is enclosing the variable i.e. its scope.
      Returns:
      the scope associated with the variable
    • registerAsUsed

      public void registerAsUsed()
      Register the variable as used.
    • registerAsInstOrClassVar

      public void registerAsInstOrClassVar()
      Register the variable as an instance variable or class variable.
    • isUsed

      public boolean isUsed()
      Is the variable used or not.
      Returns:
      true if variable is used
    • isInstVarOrClassVar

      public boolean isInstVarOrClassVar()
      Is an instance variable or a class variable.
      Returns:
      true if is an instance variable or a class variable