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. UseAbstractCheck
instead.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 class
AbstractDeclarationCollector.BlockFrame
Deprecated.A frame initiated on entering a statement list; holds local variable names.private static class
AbstractDeclarationCollector.ClassFrame
Deprecated.A frame initiated at class definition; holds instance variable names.private static class
AbstractDeclarationCollector.GlobalFrame
Deprecated.The global frame; should hold only class names.private static class
AbstractDeclarationCollector.LexicalFrame
Deprecated.A declaration frame.private static class
AbstractDeclarationCollector.MethodFrame
Deprecated.A frame initiated at method definition; holds parameter names.
-
Field Summary
Fields Modifier and Type Field Description private AbstractDeclarationCollector.LexicalFrame
current
Deprecated.Frame for the currently processed AST.private java.util.Map<DetailAST,AbstractDeclarationCollector.LexicalFrame>
frames
Deprecated.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 void
beginTree(DetailAST rootAST)
Deprecated.Called before the starting to process a tree.private static void
collectDeclarations(java.util.Deque<AbstractDeclarationCollector.LexicalFrame> frameStack, DetailAST ast)
Deprecated.Parse the next AST for declarations.private static void
collectVariableDeclarations(DetailAST ast, AbstractDeclarationCollector.LexicalFrame frame)
Deprecated.Collect Variable Declarations.private void
endCollectingDeclarations(java.util.Queue<AbstractDeclarationCollector.LexicalFrame> frameStack, DetailAST ast)
Deprecated.End parsing of the AST for declarations.private AbstractDeclarationCollector.LexicalFrame
findFrame(java.lang.String name)
Deprecated.Find frame containing declaration.protected boolean
isClassField(java.lang.String name)
Deprecated.Check if given name is a name for class field in current environment.protected boolean
isClassMethod(java.lang.String name)
Deprecated.Check if given name is a name for class method in current environment.void
visitToken(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:AbstractCheck
Called before the starting to process a tree. Ideal place to initialize information that is to be collected whilst processing a tree.- Overrides:
beginTree
in classAbstractCheck
- Parameters:
rootAST
- the root of the tree
-
visitToken
public void visitToken(DetailAST ast)
Deprecated.Description copied from class:AbstractCheck
Called to process a token.- Overrides:
visitToken
in 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
-
-