A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/pmd/pmd/issues/2454 below:

[java] UnusedPrivateMethod violation for disabled class in 6.23.0 · Issue #2454 · pmd/pmd · GitHub

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.

Running PMD through: Gradle


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