The Java standard for annotations states that if the only element used in the annotation is value, then an explicit value element is not required.
This rule will find annotations where the only element used is value and flag it as a violation, if the value element is explicit.
Rule: UnnecessaryAnnotationValueElementRule
Description:
Avoid the use of value in annotations when it's the only element.
Example:
@TestClassAnnotation(value = "TEST")
public class Foo {
@TestMemberAnnotation(value = "TEST")
private String y;
@TestMethodAnnotation(value = "TEST")
public void bar() {
int x = 42;
return;
}
}
Becomes:
@TestClassAnnotation("TEST")
public class Foo {
@TestMemberAnnotation("TEST")
private String y;
@TestMethodAnnotation("TEST")
public void bar() {
int x = 42;
return;
}
}
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4