public class DeclarationOrderCheck extends Check
Available options:
Purpose of ignore* option is to ignore related violations, however it still impacts on other class members.
For example:
class K {
int a;
void m(){}
K(){} <-- "Constructor definition in wrong order"
int b; <-- "Instance variable definition in wrong order"
}
With ignoreConstructors option:
class K {
int a;
void m(){}
K(){}
int b; <-- "Instance variable definition in wrong order"
}
With ignoreConstructors option and without a method definition in a source class:
class K {
int a;
K(){}
int b; <-- "Instance variable definition in wrong order"
}
An example of how to configure the check is:
<module name="DeclarationOrder"/>
Modifier and Type | Field and Description |
---|---|
static String |
MSG_ACCESS
A key is pointing to the warning message text in "messages.properties"
file.
|
static String |
MSG_CONSTRUCTOR
A key is pointing to the warning message text in "messages.properties"
file.
|
static String |
MSG_INSTANCE
A key is pointing to the warning message text in "messages.properties"
file.
|
static String |
MSG_STATIC
A key is pointing to the warning message text in "messages.properties"
file.
|
Constructor and Description |
---|
DeclarationOrderCheck() |
Modifier and Type | Method and Description |
---|---|
int[] |
getAcceptableTokens()
The configurable token set.
|
int[] |
getDefaultTokens()
Returns the default token a check is interested in.
|
int[] |
getRequiredTokens()
The tokens that this check must be registered for.
|
void |
leaveToken(DetailAST ast)
Called after all the child nodes have been process.
|
void |
setIgnoreConstructors(boolean ignoreConstructors)
Sets whether to ignore constructors.
|
void |
setIgnoreModifiers(boolean ignoreModifiers)
Sets whether to ignore modifiers.
|
void |
visitToken(DetailAST ast)
Called to process a token.
|
beginTree, destroy, finishTree, getClassLoader, getFileContents, getLine, getLines, getTabWidth, getTokenNames, init, isCommentNodesRequired, log, log, setClassLoader, setFileContents, setMessages, setTabWidth, setTokens
getCustomMessages, getId, getMessageBundle, getSeverity, getSeverityLevel, log, setId, setSeverity
configure, contextualize, finishLocalSetup, getConfiguration, setupChild
public static final String MSG_CONSTRUCTOR
public static final String MSG_STATIC
public static final String MSG_INSTANCE
public static final String MSG_ACCESS
public DeclarationOrderCheck()
public int[] getDefaultTokens()
Check
getDefaultTokens
in class Check
TokenTypes
public int[] getAcceptableTokens()
Check
getAcceptableTokens
in class Check
TokenTypes
public int[] getRequiredTokens()
Check
getRequiredTokens
in class Check
TokenTypes
public void visitToken(DetailAST ast)
Check
visitToken
in class Check
ast
- the token to processpublic void leaveToken(DetailAST ast)
Check
leaveToken
in class Check
ast
- the token leavingpublic void setIgnoreConstructors(boolean ignoreConstructors)
ignoreConstructors
- whether to ignore constructors.public void setIgnoreModifiers(boolean ignoreModifiers)
ignoreModifiers
- whether to ignore modifiers.Copyright © 2001–2016. All rights reserved.