public class InnerAssignmentCheck extends Check
Checks for assignments in subexpressions, such as in
String s = Integer.toString(i = 2);
.
Rationale: With the exception of for
iterators, all assignments
should occur in their own toplevel statement to increase readability.
With inner assignments like the above it is difficult to see all places
where a variable is set.
Constructor and Description |
---|
InnerAssignmentCheck() |
Modifier and Type | Method and Description |
---|---|
int[] |
getDefaultTokens()
Returns the default token a check is interested in.
|
void |
visitToken(DetailAST aAST)
Called to process a token.
|
beginTree, destroy, finishTree, getAcceptableTokens, getClassLoader, getFileContents, getLines, getRequiredTokens, getTabWidth, getTokenNames, init, leaveToken, log, log, setClassLoader, setFileContents, setMessages, setTabWidth, setTokens
getCustomMessages, getId, getMessageBundle, getSeverity, getSeverityLevel, log, setId, setSeverity
configure, contextualize, finishLocalSetup, getConfiguration, setupChild
public int[] getDefaultTokens()
Check
getDefaultTokens
in class Check
TokenTypes
public void visitToken(DetailAST aAST)
Check
visitToken
in class Check
aAST
- the token to processCopyright © 2001-2012. All Rights Reserved.