public class NoWhitespaceAfterCheck extends AbstractCheck
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 after a token, set property allowLineBreaks to false.
 By default the check will check the following operators:
  ARRAY_INIT,
  AT,
  BNOT,
  DEC,
  DOT,
  INC,
  LNOT,
  UNARY_MINUS,
  UNARY_PLUS,
  TYPECAST,
  ARRAY_DECLARATOR,
  INDEX_OP.
 
 The check processes
 ARRAY_DECLARATOR,
 INDEX_OP
 specially from other tokens. Actually it is checked that there is
 no whitespace before this tokens, not after them.
 Spaces after the ANNOTATIONS
 before ARRAY_DECLARATOR
 and INDEX_OP will be ignored.
 
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>
 
 If the annotation is between the type and the array, the check will skip validation for spaces:
 public void foo(final char @NotNull [] param) {} // No violation
 AutomaticBean.OutputStreamOptions| Modifier and Type | Field and Description | 
|---|---|
| static String | MSG_KEYA key is pointing to the warning message text in "messages.properties"
 file. | 
| 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. | 
| int[] | getRequiredTokens()The tokens that this check must be registered for. | 
| void | setAllowLineBreaks(boolean allowLineBreaks)Control whether whitespace is flagged at linebreaks. | 
| void | visitToken(DetailAST ast)Called to process a token. | 
beginTree, clearMessages, destroy, finishTree, getClassLoader, getFileContents, getLine, getLines, getMessages, getTabWidth, getTokenNames, init, isCommentNodesRequired, leaveToken, log, log, log, setClassLoader, setFileContents, setTabWidth, setTokensfinishLocalSetup, getCustomMessages, getId, getMessageBundle, getSeverity, getSeverityLevel, setId, setSeverityconfigure, contextualize, getConfiguration, setupChildpublic static final String MSG_KEY
public NoWhitespaceAfterCheck()
public int[] getDefaultTokens()
AbstractCheckgetDefaultTokens in class AbstractCheckTokenTypespublic int[] getAcceptableTokens()
AbstractCheckgetAcceptableTokens in class AbstractCheckTokenTypespublic int[] getRequiredTokens()
AbstractCheckgetRequiredTokens in class AbstractCheckTokenTypespublic void setAllowLineBreaks(boolean allowLineBreaks)
allowLineBreaks - whether whitespace should be
     flagged at linebreaks.public void visitToken(DetailAST ast)
AbstractCheckvisitToken in class AbstractCheckast - the token to processCopyright © 2001–2018. All rights reserved.