public class StaticMethodCandidateCheck
extends com.puppycrawl.tools.checkstyle.api.AbstractCheck
private methods can be declared as static.
The check has option skippedMethods which allows to specify the
list of comma separated names of methods to skip during the check. By default
the private methods which a class can have when it implements
Serializable are skipped: "readObject, writeObject, readObjectNoData, readResolve,
writeReplace".
The following configuration allows to skip method foo and bar:
<module name="NestedSwitchCheck">
<property name="skippedMethods" value="foo, bar"/>
</module>
Limitations:
| Modifier and Type | Field and Description |
|---|---|
static String |
MSG_KEY
Warning message key.
|
| Constructor and Description |
|---|
StaticMethodCandidateCheck() |
| Modifier and Type | Method and Description |
|---|---|
void |
beginTree(com.puppycrawl.tools.checkstyle.api.DetailAST rootAST) |
void |
finishTree(com.puppycrawl.tools.checkstyle.api.DetailAST ast) |
int[] |
getAcceptableTokens() |
int[] |
getDefaultTokens() |
int[] |
getRequiredTokens() |
void |
leaveToken(com.puppycrawl.tools.checkstyle.api.DetailAST ast) |
void |
setSkippedMethods(String skippedMethods)
Sets custom skipped methods.
|
void |
visitToken(com.puppycrawl.tools.checkstyle.api.DetailAST ast) |
clearMessages, destroy, getFileContents, getLine, getLines, getMessages, getTabWidth, getTokenNames, init, isCommentNodesRequired, log, log, log, setFileContents, setTabWidth, setTokensfinishLocalSetup, getCustomMessages, getId, getMessageBundle, getSeverity, getSeverityLevel, setId, setSeveritypublic static final String MSG_KEY
public void setSkippedMethods(String skippedMethods)
skippedMethods - user's skipped methods.public int[] getAcceptableTokens()
getAcceptableTokens in class com.puppycrawl.tools.checkstyle.api.AbstractCheckpublic int[] getDefaultTokens()
getDefaultTokens in class com.puppycrawl.tools.checkstyle.api.AbstractCheckpublic int[] getRequiredTokens()
getRequiredTokens in class com.puppycrawl.tools.checkstyle.api.AbstractCheckpublic void beginTree(com.puppycrawl.tools.checkstyle.api.DetailAST rootAST)
beginTree in class com.puppycrawl.tools.checkstyle.api.AbstractCheckpublic void visitToken(com.puppycrawl.tools.checkstyle.api.DetailAST ast)
visitToken in class com.puppycrawl.tools.checkstyle.api.AbstractCheckpublic void leaveToken(com.puppycrawl.tools.checkstyle.api.DetailAST ast)
leaveToken in class com.puppycrawl.tools.checkstyle.api.AbstractCheckpublic void finishTree(com.puppycrawl.tools.checkstyle.api.DetailAST ast)
finishTree in class com.puppycrawl.tools.checkstyle.api.AbstractCheckCopyright © 2021. All rights reserved.