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,
ARRAY_DECLARATOR,
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>
| Constructor and Description |
|---|
NoWhitespaceAfterCheck() |
| Modifier and Type | Method and Description |
|---|---|
int[] |
getAcceptableTokens()
The configurable token set.
|
int[] |
getDefaultTokens()
Returns the default token a check is interested in.
|
void |
setAllowLineBreaks(boolean allowLineBreaks)
Control whether whitespace is flagged at linebreaks.
|
void |
visitToken(DetailAST ast)
Called to process a token.
|
beginTree, destroy, finishTree, getClassLoader, getFileContents, getLine, getLines, getRequiredTokens, getTabWidth, getTokenNames, init, isCommentNodesRequired, leaveToken, log, log, setClassLoader, setFileContents, setMessages, setTabWidth, setTokensgetCustomMessages, getId, getMessageBundle, getSeverity, getSeverityLevel, log, setId, setSeverityconfigure, contextualize, finishLocalSetup, getConfiguration, setupChildpublic NoWhitespaceAfterCheck()
public int[] getDefaultTokens()
CheckgetDefaultTokens in class CheckTokenTypespublic int[] getAcceptableTokens()
CheckgetAcceptableTokens in class CheckTokenTypespublic void visitToken(DetailAST ast)
CheckvisitToken in class Checkast - the token to processpublic void setAllowLineBreaks(boolean allowLineBreaks)
allowLineBreaks - whether whitespace should be
flagged at linebreaks.Copyright © 2001–2015. All rights reserved.