public class AnnotationLocationCheck extends Check
Example:
@Override @Nullable public String getNameIfPresent() { ... }
Check have following options:
Example to allow single parameterless annotation on the same line:
@Override public int hashCode() { ... }
Use following configuration:
<module name="AnnotationLocation"> <property name="allowSamelineMultipleAnnotations" value="false"/> <property name="allowSamelineSingleParameterlessAnnotation" value="true"/> <property name="allowSamelineParameterizedAnnotation" value="false" /> </module>
Example to allow multiple parameterized annotations on the same line:
@SuppressWarnings("deprecation") @Mock DataLoader loader;
Use following configuration:
<module name="AnnotationLocation"> <property name="allowSamelineMultipleAnnotations" value="true"/> <property name="allowSamelineSingleParameterlessAnnotation" value="true"/> <property name="allowSamelineParameterizedAnnotation" value="true" /> </module>
Example to allow multiple parameterless annotations on the same line:
@Partial @Mock DataLoader loader;
Use following configuration:
<module name="AnnotationLocation"> <property name="allowSamelineMultipleAnnotations" value="true"/> <property name="allowSamelineSingleParameterlessAnnotation" value="true"/> <property name="allowSamelineParameterizedAnnotation" value="false" /> </module>
Modifier and Type | Field and Description |
---|---|
static String |
MSG_KEY_ANNOTATION_LOCATION
A key is pointing to the warning message text in "messages.properties"
file.
|
static String |
MSG_KEY_ANNOTATION_LOCATION_ALONE
A key is pointing to the warning message text in "messages.properties"
file.
|
Constructor and Description |
---|
AnnotationLocationCheck() |
Modifier and Type | Method and Description |
---|---|
int[] |
getDefaultTokens()
Returns the default token a check is interested in.
|
void |
setAllowSamelineMultipleAnnotations(boolean allow)
Some javadoc.
|
void |
setAllowSamelineParametrizedAnnotation(boolean allow)
Some javadoc.
|
void |
setAllowSamelineSingleParameterlessAnnotation(boolean allow)
Some javadoc.
|
void |
visitToken(DetailAST ast)
Called to process a token.
|
beginTree, destroy, finishTree, getAcceptableTokens, getClassLoader, getFileContents, getLine, getLines, getRequiredTokens, getTabWidth, getTokenNames, init, isCommentNodesRequired, leaveToken, log, log, setClassLoader, setFileContents, setMessages, setTabWidth, setTokens
getCustomMessages, getId, getMessageBundle, getSeverity, getSeverityLevel, log, setId, setSeverity
configure, contextualize, finishLocalSetup, getConfiguration, setupChild
public static final String MSG_KEY_ANNOTATION_LOCATION_ALONE
public static final String MSG_KEY_ANNOTATION_LOCATION
public AnnotationLocationCheck()
public final void setAllowSamelineSingleParameterlessAnnotation(boolean allow)
allow
- Some javadoc.public final void setAllowSamelineParametrizedAnnotation(boolean allow)
allow
- Some javadoc.public final void setAllowSamelineMultipleAnnotations(boolean allow)
allow
- Some javadoc.public int[] getDefaultTokens()
Check
getDefaultTokens
in class Check
TokenTypes
public void visitToken(DetailAST ast)
Check
visitToken
in class Check
ast
- the token to processCopyright © 2001–2015. All rights reserved.