Class UnusedLocalVariableCheck.TypeDeclDesc
- java.lang.Object
-
- com.puppycrawl.tools.checkstyle.checks.coding.UnusedLocalVariableCheck.TypeDeclDesc
-
- Enclosing class:
- UnusedLocalVariableCheck
private static final class UnusedLocalVariableCheck.TypeDeclDesc extends Object
Maintains information about the type declaration. Any ast node of typeTokenTypes.CLASS_DEF
orTokenTypes.INTERFACE_DEF
orTokenTypes.ENUM_DEF
orTokenTypes.ANNOTATION_DEF
orTokenTypes.RECORD_DEF
is considered as a type declaration.
-
-
Field Summary
Fields Modifier and Type Field Description private int
depth
Depth of nesting of type declaration.private Deque<UnusedLocalVariableCheck.VariableDesc>
instanceAndClassVarStack
A stack of type declaration's instance and static variables.private String
qualifiedName
Complete type declaration name with package name and outer type declaration name.private DetailAST
typeDeclAst
Type declaration ast node.
-
Constructor Summary
Constructors Modifier Constructor Description private
TypeDeclDesc(String qualifiedName, int depth, DetailAST typeDeclAst)
Create a new TypeDeclDesc instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addInstOrClassVar(UnusedLocalVariableCheck.VariableDesc variableDesc)
Add an instance variable or class variable to the stack.int
getDepth()
Get the depth of type declaration.String
getQualifiedName()
Get the complete type declaration name i.e. type declaration name with package name and outer type declaration name.DetailAST
getTypeDeclAst()
Get the type declaration ast node.Deque<UnusedLocalVariableCheck.VariableDesc>
getUpdatedCopyOfVarStack(DetailAST literalNewAst)
Get the copy of variables in instanceAndClassVar stack with updated scope.
-
-
-
Field Detail
-
qualifiedName
private final String qualifiedName
Complete type declaration name with package name and outer type declaration name.
-
depth
private final int depth
Depth of nesting of type declaration.
-
typeDeclAst
private final DetailAST typeDeclAst
Type declaration ast node.
-
instanceAndClassVarStack
private final Deque<UnusedLocalVariableCheck.VariableDesc> instanceAndClassVarStack
A stack of type declaration's instance and static variables.
-
-
Constructor Detail
-
TypeDeclDesc
private TypeDeclDesc(String qualifiedName, int depth, DetailAST typeDeclAst)
Create a new TypeDeclDesc instance.- Parameters:
qualifiedName
- qualified namedepth
- depth of nestingtypeDeclAst
- type declaration ast node
-
-
Method Detail
-
getQualifiedName
public String getQualifiedName()
Get the complete type declaration name i.e. type declaration name with package name and outer type declaration name.- Returns:
- qualified class name
-
getDepth
public int getDepth()
Get the depth of type declaration.- Returns:
- the depth of nesting of type declaration
-
getTypeDeclAst
public DetailAST getTypeDeclAst()
Get the type declaration ast node.- Returns:
- ast node of the type declaration
-
getUpdatedCopyOfVarStack
public Deque<UnusedLocalVariableCheck.VariableDesc> getUpdatedCopyOfVarStack(DetailAST literalNewAst)
Get the copy of variables in instanceAndClassVar stack with updated scope.- Parameters:
literalNewAst
- ast node of typeTokenTypes.LITERAL_NEW
- Returns:
- copy of variables in instanceAndClassVar stack with updated scope.
-
addInstOrClassVar
public void addInstOrClassVar(UnusedLocalVariableCheck.VariableDesc variableDesc)
Add an instance variable or class variable to the stack.- Parameters:
variableDesc
- variable to be added
-
-