A RetroSearch Logo

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

Search Query:

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

[java] MissingStaticMethodInNonInstantiatableClass false-positive for Lombok's @UtilityClass for classes with non-private fields · Issue #4393 · pmd/pmd · GitHub

Affects PMD Version: 6.52.0

Rule: MissingStaticMethodInNonInstantiatableClass

Please provide the rule name and a link to the rule documentation:
https://pmd.github.io/latest/pmd_rules_java_errorprone.html#missingstaticmethodinnoninstantiatableclass

Description:

Issue #4224 fixed false-negative problem of omitting Lombok's @UtilityClass from being verified at all, but introduced problems for utility classes that contain only field members. Actually, we should check whether a class has both private fields only AND private methods only.

Code Sample demonstrating the issue:

@UtilityClass
public final class Test {
   public static final String CONSTANT = "Constant";
}

Expected outcome:

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

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