public class GenericWhitespaceCheck extends AbstractCheck
Checks that the whitespace around the Generic tokens (angle brackets) "<" and ">" are correct to the typical convention. The convention is not configurable.
Left angle bracket ("<"):
Right angle bracket (">"):
Examples with correct spacing:
public void <K, V extends Number> boolean foo(K, V) {} // Generic methods definitions
class name<T1, T2, ..., Tn> {} // Generic type definition
OrderedPair<String, Box<Integer>> p; // Generic type reference
boolean same = Util.<Integer, String>compare(p1, p2); // Generic preceded method name
Pair<Integer, String> p1 = new Pair<>(1, "apple");// Diamond operator
List<T> list = ImmutableList.Builder<T>::new; // Method reference
sort(list, Comparable::<String>compareTo); // Method reference
AutomaticBean.OutputStreamOptions| Modifier and Type | Field and Description |
|---|---|
static String |
MSG_WS_FOLLOWED
A key is pointing to the warning message text in "messages.properties"
file.
|
static String |
MSG_WS_ILLEGAL_FOLLOW
A key is pointing to the warning message text in "messages.properties"
file.
|
static String |
MSG_WS_NOT_PRECEDED
A key is pointing to the warning message text in "messages.properties"
file.
|
static String |
MSG_WS_PRECEDED
A key is pointing to the warning message text in "messages.properties"
file.
|
| Constructor and Description |
|---|
GenericWhitespaceCheck() |
| Modifier and Type | Method and Description |
|---|---|
void |
beginTree(DetailAST rootAST)
Called before the starting to process a tree.
|
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 |
visitToken(DetailAST ast)
Called to process a token.
|
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_WS_PRECEDED
public static final String MSG_WS_FOLLOWED
public static final String MSG_WS_NOT_PRECEDED
public static final String MSG_WS_ILLEGAL_FOLLOW
public GenericWhitespaceCheck()
public int[] getDefaultTokens()
AbstractCheckgetDefaultTokens in class AbstractCheckTokenTypespublic int[] getAcceptableTokens()
AbstractCheckgetAcceptableTokens in class AbstractCheckTokenTypespublic int[] getRequiredTokens()
AbstractCheckgetRequiredTokens in class AbstractCheckTokenTypespublic void beginTree(DetailAST rootAST)
AbstractCheckbeginTree in class AbstractCheckrootAST - the root of the treepublic void visitToken(DetailAST ast)
AbstractCheckvisitToken in class AbstractCheckast - the token to processCopyright © 2001–2018. All rights reserved.