A RetroSearch Logo

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

Search Query:

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

false positive with lombok's @UtilityClass · Issue #4455 · pmd/pmd · GitHub

Affects PMD Version:7.0.0-rc1

Rule: FieldNamingConventions

Please provide the rule name and a link to the rule documentation:
https://docs.pmd-code.org/latest/pmd_rules_java_codestyle.html#fieldnamingconventions

Description:
The Test1 uses @UtilityClass, making the field static. So the two classes Test1 and Test2 are equivalent. However, PMD reports a warning in Test1 and no warnings in Test2 because PMD does not consider the annotation @UtilityClass. PMD should not report a warning in Test1 like the Test2.

Code Sample demonstrating the issue:

import lombok.experimental.UtilityClass;
public  class Foo {
    @UtilityClass
    public class Test1 {
        private final String FINAL_F = "final_field";  // report a warning
    }
    public class Test2 {
        private static final String FINAL_F = "final_field";  // report no warning
    }
}

Expected outcome:

PMD reports a violation at line 4, but that's wrong. That's a false positive.

Running PMD through: CLI


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