Remove redundant annotations when applying 'default annotation'
stylismo opened this issue · 1 comments
stylismo commented
When a default annotation like @ParamsAreNonnullByDefault
is added to package-info.java
, the existing @Nonnull
annotations on the parameters of all methods of all classes in that package should be removed.
This should not be limited to @Nonnull
but instead all configured annotations of that kind, e.g. @NotNull
The element types used in the default annotation being applied to the package should be considered when removing redundant annotations.
For example when a project uses the following default annotation and the user applies this to the current package:
@Documented
@Nonnull
@TypeQualifierDefault({
ElementType.FIELD,
ElementType.METHOD,
ElementType.PARAMETER,
})
@Retention(java.lang.annotation.RetentionPolicy.RUNTIME)
public @interface NonnullByDefault {
}
Then all redundant @Nonnull
annotations should be removed from fields, methods and parameters in that package.
stylismo commented