Affects PMD Version:
6.2.0
Rule:
ImmutableField and SingularField
Description:
Newly announced parameter ignoredAnnotations is present in these rules, but it doesn't ignore any violations.
Method net.sourceforge.pmd.lang.java.rule.AbstractIgnoredAnnotationRule#hasIgnoredAnnotation is used only in UnusedPrivateField and UnusedPrivateMethod rules and feature works well for them.
Code Sample demonstrating the issue:
<rule ref="category/java/design.xml/SingularField">
<properties>
<property name="ignoredAnnotations" value="java.lang.Deprecated"/>
</properties>
</rule>
public class Source {
@Deprecated
private Object o; //violation!
Object m() {
o = new Object();
return o;
}
}
Running PMD through: Gradle
Affects PMD Version:
6.2.0
Rule:
ImmutableFieldandSingularFieldDescription:
Newly announced parameter
ignoredAnnotationsis present in these rules, but it doesn't ignore any violations.Method
net.sourceforge.pmd.lang.java.rule.AbstractIgnoredAnnotationRule#hasIgnoredAnnotationis used only inUnusedPrivateFieldandUnusedPrivateMethodrules and feature works well for them.Code Sample demonstrating the issue:
Running PMD through: Gradle