Class AbstractDeclarationCollector
- java.lang.Object
-
- com.puppycrawl.tools.checkstyle.api.AutomaticBean
-
- com.puppycrawl.tools.checkstyle.api.AbstractViolationReporter
-
- com.puppycrawl.tools.checkstyle.api.AbstractCheck
-
- com.puppycrawl.tools.checkstyle.checks.AbstractDeclarationCollector
-
- All Implemented Interfaces:
Configurable,Contextualizable
@Deprecated public abstract class AbstractDeclarationCollector extends AbstractCheck
Deprecated.Checkstyle will not support abstract checks anymore. UseAbstractCheckinstead.Abstract class for checks which need to collect information about declared members/parameters/variables.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classAbstractDeclarationCollector.BlockFrameDeprecated.A frame initiated on entering a statement list; holds local variable names.private static classAbstractDeclarationCollector.ClassFrameDeprecated.A frame initiated at class definition; holds instance variable names.private static classAbstractDeclarationCollector.GlobalFrameDeprecated.The global frame; should hold only class names.private static classAbstractDeclarationCollector.LexicalFrameDeprecated.A declaration frame.private static classAbstractDeclarationCollector.MethodFrameDeprecated.A frame initiated at method definition; holds parameter names.
-
Field Summary
Fields Modifier and Type Field Description private AbstractDeclarationCollector.LexicalFramecurrentDeprecated.Frame for the currently processed AST.private java.util.Map<DetailAST,AbstractDeclarationCollector.LexicalFrame>framesDeprecated.Tree of all the parsed frames.
-
Constructor Summary
Constructors Constructor Description AbstractDeclarationCollector()Deprecated.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidbeginTree(DetailAST rootAST)Deprecated.Called before the starting to process a tree.private static voidcollectDeclarations(java.util.Deque<AbstractDeclarationCollector.LexicalFrame> frameStack, DetailAST ast)Deprecated.Parse the next AST for declarations.private static voidcollectVariableDeclarations(DetailAST ast, AbstractDeclarationCollector.LexicalFrame frame)Deprecated.Collect Variable Declarations.private voidendCollectingDeclarations(java.util.Queue<AbstractDeclarationCollector.LexicalFrame> frameStack, DetailAST ast)Deprecated.End parsing of the AST for declarations.private AbstractDeclarationCollector.LexicalFramefindFrame(java.lang.String name)Deprecated.Find frame containing declaration.protected booleanisClassField(java.lang.String name)Deprecated.Check if given name is a name for class field in current environment.protected booleanisClassMethod(java.lang.String name)Deprecated.Check if given name is a name for class method in current environment.voidvisitToken(DetailAST ast)Deprecated.Called to process a token.-
Methods inherited from class com.puppycrawl.tools.checkstyle.api.AbstractCheck
destroy, finishTree, getAcceptableTokens, getClassLoader, getDefaultTokens, getFileContents, getLine, getLines, getRequiredTokens, getTabWidth, getTokenNames, init, isCommentNodesRequired, leaveToken, log, log, setClassLoader, setFileContents, setMessages, setTabWidth, setTokens
-
Methods inherited from class com.puppycrawl.tools.checkstyle.api.AbstractViolationReporter
getCustomMessages, getId, getMessageBundle, getSeverity, getSeverityLevel, log, setId, setSeverity
-
Methods inherited from class com.puppycrawl.tools.checkstyle.api.AutomaticBean
configure, contextualize, finishLocalSetup, getConfiguration, setupChild
-
-
-
-
Field Detail
-
frames
private java.util.Map<DetailAST,AbstractDeclarationCollector.LexicalFrame> frames
Deprecated.Tree of all the parsed frames.
-
current
private AbstractDeclarationCollector.LexicalFrame current
Deprecated.Frame for the currently processed AST.
-
-
Method Detail
-
beginTree
public void beginTree(DetailAST rootAST)
Deprecated.Description copied from class:AbstractCheckCalled before the starting to process a tree. Ideal place to initialize information that is to be collected whilst processing a tree.- Overrides:
beginTreein classAbstractCheck- Parameters:
rootAST- the root of the tree
-
visitToken
public void visitToken(DetailAST ast)
Deprecated.Description copied from class:AbstractCheckCalled to process a token.- Overrides:
visitTokenin classAbstractCheck- Parameters:
ast- the token to process
-
collectDeclarations
private static void collectDeclarations(java.util.Deque<AbstractDeclarationCollector.LexicalFrame> frameStack, DetailAST ast)
Deprecated.Parse the next AST for declarations.- Parameters:
frameStack- Stack containing the FrameTree being builtast- AST to parse
-
collectVariableDeclarations
private static void collectVariableDeclarations(DetailAST ast, AbstractDeclarationCollector.LexicalFrame frame)
Deprecated.Collect Variable Declarations.- Parameters:
ast- variable tokenframe- current frame
-
endCollectingDeclarations
private void endCollectingDeclarations(java.util.Queue<AbstractDeclarationCollector.LexicalFrame> frameStack, DetailAST ast)
Deprecated.End parsing of the AST for declarations.- Parameters:
frameStack- Stack containing the FrameTree being builtast- AST that was parsed
-
isClassField
protected final boolean isClassField(java.lang.String name)
Deprecated.Check if given name is a name for class field in current environment.- Parameters:
name- a name to check- Returns:
- true is the given name is name of member.
-
isClassMethod
protected final boolean isClassMethod(java.lang.String name)
Deprecated.Check if given name is a name for class method in current environment.- Parameters:
name- a name to check- Returns:
- true is the given name is name of method.
-
findFrame
private AbstractDeclarationCollector.LexicalFrame findFrame(java.lang.String name)
Deprecated.Find frame containing declaration.- Parameters:
name- name of the declaration to find- Returns:
- LexicalFrame containing declaration or null
-
-