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 ast)
Called to process a token.
|
beginTree, destroy, finishTree, getAcceptableTokens, getClassLoader, getFileContents, getLine, getLines, getRequiredTokens, getTabWidth, getTokenNames, init, isCommentNodesRequired, leaveToken, log, log, setClassLoader, setFileContents, setMessages, setTabWidth, setTokens
getCustomMessages, getId, getMessageBundle, getSeverity, getSeverityLevel, log, setId, setSeverity
configure, contextualize, finishLocalSetup, getConfiguration, setupChild
public InnerAssignmentCheck()
public int[] getDefaultTokens()
Check
getDefaultTokens
in class Check
TokenTypes
public void visitToken(DetailAST ast)
Check
visitToken
in class Check
ast
- the token to processCopyright © 2001–2015. All rights reserved.