A RetroSearch Logo

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

Search Query:

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

[java] UnusedPrivateField on member annotated with lombok @Delegate · Issue #1703 · pmd/pmd · GitHub

Affects PMD Version: 6.12.0

Rule: UnusedPrivateField

Description:
Lombok @Delegate on a member, means that lombok will generate methods into the class which mirror the method signatures of that member variable, and the bodies of the methods are just a simple delegation to the member. Obviously it makes use of the member variable; so it should not trigger PMD's UnusedPrivateField rule, but it does.

https://projectlombok.org/features/Delegate.html

Code Sample demonstrating the issue:

public class Foo {
    @Delegate private Bar bar;
}

Running PMD through: Maven -- but with dependency override to PMD version 6.12.0.

P.S. I think there could be a workaround, using violationSuppressXPath to suppress the UnusedPrivateField on members with the Delegate annotation. But I haven't yet figured out the XPath to match it. If an XPath wizard wants to share the right incantation it would be much appreciated!


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