Rule: UnusedPrivateField
With PMD 6.50 the rule UnusedPrivateField was changed to completely ignore any private field with an annotation (see #4100).
But what if the previous behaviour was totally ok? How to restore it? In my case I do want to find unused private fields even with annotation.
If you need a use case for that: Java Selenium Tests
There you annotate WebElements with the locator that points to the corresponding Element on the web page.
It looks like this:
@FindBy(id = "whateverID") private WebElement myElement;
A class like this could have a bunch of WebElements and if some of them are unused, you don't see it.
If I don't use myElement, I want to remove it and I want PMD to find it.
Maybe at least a kind of whitelist could be added to configure PMD to find fields even if they have annotations that are on this list.
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