public abstract class AbstractSuperCheck extends AbstractCheck
Abstract class for checking that an overriding method with no parameters invokes the super method.
| Modifier and Type | Class and Description |
|---|---|
private static class |
AbstractSuperCheck.MethodNode
Stack node for a method definition and a record of
whether the method has a call to the super method.
|
AutomaticBean.OutputStreamOptions| Modifier and Type | Field and Description |
|---|---|
private java.util.Deque<AbstractSuperCheck.MethodNode> |
methodStack
Stack of methods.
|
static java.lang.String |
MSG_KEY
A key is pointing to the warning message text in "messages.properties"
file.
|
| Constructor and Description |
|---|
AbstractSuperCheck() |
| Modifier and Type | Method and Description |
|---|---|
void |
beginTree(DetailAST rootAST)
Called before the starting to process a tree.
|
int[] |
getAcceptableTokens()
The configurable token set.
|
int[] |
getDefaultTokens()
Returns the default token a check is interested in.
|
protected abstract java.lang.String |
getMethodName()
Returns the name of the overriding method.
|
int[] |
getRequiredTokens()
The tokens that this check must be registered for.
|
private static boolean |
hasArguments(DetailAST methodCallDotAst)
Does method have any arguments.
|
private boolean |
isOverridingMethod(DetailAST ast)
Determines whether an AST is a method definition for this check,
without any parameters.
|
private boolean |
isSameNameMethod(DetailAST ast)
Is same name of method.
|
private boolean |
isSuperCall(DetailAST literalSuperAst)
Determines whether a 'super' literal is a call to the super method
for this check.
|
private boolean |
isSuperCallInOverridingMethod(DetailAST ast)
Determines whether a super call in overriding method.
|
void |
leaveToken(DetailAST ast)
Called after all the child nodes have been process.
|
void |
visitToken(DetailAST ast)
Called to process a token.
|
clearViolations, destroy, finishTree, getFileContents, getLine, getLineCodePoints, getLines, getTabWidth, getTokenNames, getViolations, init, isCommentNodesRequired, log, log, log, setFileContents, setTabWidth, setTokensfinishLocalSetup, getCustomMessages, getId, getMessageBundle, getSeverity, getSeverityLevel, setId, setSeverityconfigure, contextualize, getConfiguration, setupChildpublic static final java.lang.String MSG_KEY
private final java.util.Deque<AbstractSuperCheck.MethodNode> methodStack
public AbstractSuperCheck()
protected abstract java.lang.String getMethodName()
public int[] getAcceptableTokens()
AbstractCheckgetAcceptableTokens in class AbstractCheckTokenTypespublic int[] getDefaultTokens()
AbstractCheckgetDefaultTokens in class AbstractCheckTokenTypespublic int[] getRequiredTokens()
AbstractCheckgetRequiredTokens in class AbstractCheckTokenTypespublic void beginTree(DetailAST rootAST)
AbstractCheckbeginTree in class AbstractCheckrootAST - the root of the treepublic void visitToken(DetailAST ast)
AbstractCheckvisitToken in class AbstractCheckast - the token to processprivate boolean isSuperCall(DetailAST literalSuperAst)
literalSuperAst - the AST node of a 'super' literal.private boolean isSuperCallInOverridingMethod(DetailAST ast)
ast - The AST node of a 'dot operator' in 'super' call.private static boolean hasArguments(DetailAST methodCallDotAst)
methodCallDotAst - DOT DetailASTprivate boolean isSameNameMethod(DetailAST ast)
ast - method ASTpublic void leaveToken(DetailAST ast)
AbstractCheckleaveToken in class AbstractCheckast - the token leavingprivate boolean isOverridingMethod(DetailAST ast)
ast - the method definition AST.Copyright © 2001-2022. All Rights Reserved.