Affects PMD Version: 6.23.0
Rule:
UnusedPrivateMethod
https://pmd.github.io/pmd-6.23.0/pmd_rules_java_bestpractices.html#unusedprivatemethod
Description:
In 6.22.0 the rule uses the classes listed in the ignoredAnnotationsproperty as expected. In 6.23.0 I'm getting a violation for the class javax.annotation.PreDestroyon a private method.
Code Sample demonstrating the issue:
import javax.annotation.PreDestroy;
@PreDestroy
private void shutdown() {
server.shutdown();
}
Ruleset:
<rule ref="category/java/bestpractices.xml/UnusedPrivateMethod">
<properties>
<property name="ignoredAnnotations" value="java.lang.Deprecated|javax.annotation.PostConstruct|
javax.annotation.PreDestroy|org.springframework.context.event.EventListener|
org.springframework.scheduling.annotation.Scheduled"/>
</properties>
</rule>
Expected outcome:
The private method annotated with @PreDestroy should not be a violation.
- Does PMD report a violation, where there shouldn't be one? -> false-positive
Running PMD through: Gradle
Affects PMD Version: 6.23.0
Rule:
UnusedPrivateMethod
https://pmd.github.io/pmd-6.23.0/pmd_rules_java_bestpractices.html#unusedprivatemethod
Description:
In 6.22.0 the rule uses the classes listed in the
ignoredAnnotationsproperty as expected. In 6.23.0 I'm getting a violation for the classjavax.annotation.PreDestroyon a private method.Code Sample demonstrating the issue:
Ruleset:
Expected outcome:
The private method annotated with
@PreDestroyshould not be a violation.Running PMD through: Gradle