public class NoWhitespaceAfterCheck extends Check
Checks that there is no whitespace after a token. More specifically, it checks that it is not followed by whitespace, or (if linebreaks are allowed) all characters on the line after are whitespace. To forbid linebreaks afer a token, set property allowLineBreaks to false.
By default the check will check the following operators:
ARRAY_INIT
,
BNOT
,
DEC
,
DOT
,
INC
,
LNOT
,
UNARY_MINUS
,
UNARY_PLUS
. It also supports the operator
TYPECAST
.
An example of how to configure the check is:
<module name="NoWhitespaceAfter"/>
An example of how to configure the check to forbid linebreaks after
a DOT
token is:
<module name="NoWhitespaceAfter"> <property name="tokens" value="DOT"/> <property name="allowLineBreaks" value="false"/> </module>
DEFAULT_ERROR_SCORE, DEFAULT_INFO_SCORE, DEFAULT_WARNING_SCORE, mScoring, mViolationSize
コンストラクタと説明 |
---|
NoWhitespaceAfterCheck() |
修飾子とタイプ | メソッドと説明 |
---|---|
int[] |
getAcceptableTokens()
The configurable token set.
|
int[] |
getDefaultTokens()
Returns the default token a check is interested in.
|
void |
setAllowLineBreaks(boolean aAllowLineBreaks)
Control whether whitespace is flagged at linebreaks.
|
void |
visitToken(DetailAST aAST)
Called to process a token.
|
beginTree, destroy, finishTree, getClassLoader, getFileContents, getLines, getRequiredTokens, getTabWidth, getTokenNames, init, leaveToken, 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[] getAcceptableTokens()
Check
getAcceptableTokens
クラス内 Check
TokenTypes
public void visitToken(DetailAST aAST)
Check
visitToken
クラス内 Check
aAST
- the token to processpublic void setAllowLineBreaks(boolean aAllowLineBreaks)
aAllowLineBreaks
- whether whitespace should be
flagged at linebreaks.Copyright © 2001-2013. All Rights Reserved.