[java] Do not report MissingStaticMethodInNonInstantiatableClass for class with @lombok.Builder

This commit is contained in:
Krzysztof Debski
2024-07-11 17:24:38 +02:00
parent 3a66d50ac2
commit 3609034bf7
2 changed files with 15 additions and 2 deletions

View File

@ -2099,7 +2099,8 @@ $topLevelClass[
(: no lombok produced constructors :)
not(pmd-java:hasAnnotation('lombok.NoArgsConstructor') or
pmd-java:hasAnnotation('lombok.RequiredArgsConstructor') or
pmd-java:hasAnnotation('lombok.AllArgsConstructor')) and
pmd-java:hasAnnotation('lombok.AllArgsConstructor') or
pmd-java:hasAnnotation('lombok.Builder')) and
(: or has non-default constructors … :)
ClassBody/ConstructorDeclaration and
(: … but only private … :)

View File

@ -594,7 +594,7 @@ public class Bar extends Foo {
</test-code>
<test-code>
<description>#1488:[java]false-positive about MissingStaticMethodInNonInstantiatableClass and @lombok.Builder</description>
<description>#1488:[java]false-positive about MissingStaticMethodInNonInstantiatableClass and @lombok.Builder on constructor</description>
<expected-problems>0</expected-problems>
<code><![CDATA[
import lombok.Builder;
@ -602,6 +602,18 @@ public class Foo {
@Builder
private Foo() {}
}
]]></code>
</test-code>
<test-code>
<description>#1488:[java]false-positive about MissingStaticMethodInNonInstantiatableClass and @lombok.Builder on class</description>
<expected-problems>0</expected-problems>
<code><![CDATA[
import lombok.Builder;
@Builder
public class Foo {
private Foo() {}
}
]]></code>
</test-code>