|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.puppycrawl.tools.checkstyle.api.AutomaticBean com.puppycrawl.tools.checkstyle.api.AbstractViolationReporter com.puppycrawl.tools.checkstyle.api.Check com.puppycrawl.tools.checkstyle.checks.usage.AbstractUsageCheck com.puppycrawl.tools.checkstyle.checks.usage.OneMethodPrivateFieldCheck
Checks that a private field is used in more than one method, constructor, or initializer.
Rationale: a private field used in only one method, constructor, or initializer should be replaced by a local variable.
An example of how to configure the check is:
<module name="usage.OneMethodPrivateField"/>
Constructor Summary | |
OneMethodPrivateFieldCheck()
|
Method Summary | |
void |
applyTo(java.util.Set aNodes)
Applies this check to a set of nodes. |
int[] |
getDefaultTokens()
Returns the default token a check is interested in. |
java.lang.String |
getErrorKey()
Returns the key for the Checkstyle error message. |
boolean |
mustCheckReferenceCount(DetailAST aAST)
Determines whether the reference count of an aAST is required. |
Methods inherited from class com.puppycrawl.tools.checkstyle.checks.usage.AbstractUsageCheck |
beginTree, finishTree, getASTManager, getIgnoreFormat, getRegexp, logError, setIgnoreFormat, visitToken |
Methods inherited from class com.puppycrawl.tools.checkstyle.api.Check |
destroy, getAcceptableTokens, getClassLoader, getFileContents, getLines, getRequiredTokens, getTabWidth, getTokenNames, init, leaveToken, log, log, setClassLoader, setFileContents, setMessages, setTabWidth, setTokens |
Methods inherited from class com.puppycrawl.tools.checkstyle.api.AbstractViolationReporter |
getMessageBundle, getSeverity, getSeverityLevel, log, log, log, log, log, log, log, log, log, setSeverity |
Methods inherited from class com.puppycrawl.tools.checkstyle.api.AutomaticBean |
configure, contextualize, finishLocalSetup, getConfiguration, setupChild |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public OneMethodPrivateFieldCheck()
Method Detail |
public int[] getDefaultTokens()
Check
getDefaultTokens
in class Check
Check
public java.lang.String getErrorKey()
AbstractUsageCheck
getErrorKey
in class AbstractUsageCheck
AbstractUsageCheck
public boolean mustCheckReferenceCount(DetailAST aAST)
AbstractUsageCheck
mustCheckReferenceCount
in class AbstractUsageCheck
aAST
- the node to check.
AbstractUsageCheck
public void applyTo(java.util.Set aNodes)
AbstractUsageCheck
applyTo
in class AbstractUsageCheck
aNodes
- the nodes to check.AbstractUsageCheck
|
Back to the Checkstyle Home Page | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |