You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description:
I found a regresson in the rule ClassWithOnlyPrivateConstructorsShouldBeFinal as @AllArgsConstructor annotation was added to the filter that assumes the annotation always generates a public constructor at ClassWithOnlyPrivateConstructorsShouldBeFinal.java. However, PMD does not consider the parameters of the annotation. When using the staticName="build" , the class does not generate a public constructor, leading to a false negative. Case2 is equivalent to Case1, and PMD reported a warning.
Affects PMD Version: 7.2.0
Rule: ClassWithOnlyPrivateConstructorsShouldBeFinal
https://docs.pmd-code.org/latest/pmd_rules_java_design.html#classwithonlyprivateconstructorsshouldbefinal
Description:
I found a regresson in the rule
ClassWithOnlyPrivateConstructorsShouldBeFinal
as@AllArgsConstructor
annotation was added to the filter that assumes the annotation always generates a public constructor at ClassWithOnlyPrivateConstructorsShouldBeFinal.java. However, PMD does not consider the parameters of the annotation. When using thestaticName="build"
, the class does not generate a public constructor, leading to a false negative. Case2 is equivalent to Case1, and PMD reported a warning.Code Sample demonstrating the issue:
Case1
Case2
Expected outcome:
PMD does not report a violation at line 3 in the first case, but that's wrong. That's a false negative.
Running PMD through: [CLI]
The text was updated successfully, but these errors were encountered: