public final class MutableExceptionCheck extends AbstractFormatCheck
Ensures that exceptions (defined as any class name conforming to some regular expression) are immutable. That is, have only final fields.
Rationale: Exception instances should represent an error condition. Having non final fields not only allows the state to be modified by accident and therefore mask the original condition but also allows developers to accidentally forget to initialise state thereby leading to code catching the exception to draw incorrect conclusions based on the state.
DEFAULT_ERROR_SCORE, DEFAULT_INFO_SCORE, DEFAULT_WARNING_SCORE, mScoring, mViolationSize
コンストラクタと説明 |
---|
MutableExceptionCheck()
Creates new instance of the check.
|
修飾子とタイプ | メソッドと説明 |
---|---|
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 aAST)
Called after all the child nodes have been process.
|
void |
visitToken(DetailAST aAST)
Called to process a token.
|
getFormat, getRegexp, setCompileFlags, setFormat
beginTree, destroy, finishTree, getAcceptableTokens, getClassLoader, getFileContents, getLines, getTabWidth, getTokenNames, init, log, log, setClassLoader, setFileContents, setMessages, setTabWidth, setTokens
calculateScore, getCustomMessages, getErrorScore, getId, getInfoScore, getMessageBundle, getScore, getScoring, getSeverity, getSeverityLevel, getWarningScore, log, setErrorScore, setId, setInfoScore, setScore, setScoring, setSeverity, setWarningScore
configure, contextualize, finishLocalSetup, getConfiguration, setupChild
public int[] getDefaultTokens()
Check
getDefaultTokens
クラス内 Check
TokenTypes
public int[] getRequiredTokens()
Check
getRequiredTokens
クラス内 Check
TokenTypes
public void visitToken(DetailAST aAST)
Check
visitToken
クラス内 Check
aAST
- the token to processpublic void leaveToken(DetailAST aAST)
Check
leaveToken
クラス内 Check
aAST
- the token leavingCopyright © 2001-2013. All Rights Reserved.