diff --git a/docs/pages/release_notes.md b/docs/pages/release_notes.md index f76873c8f8..dc752150f9 100644 --- a/docs/pages/release_notes.md +++ b/docs/pages/release_notes.md @@ -34,6 +34,7 @@ This is a {{ site.pmd.release_type }} release. * [#4201](https://github.com/pmd/pmd/issues/4201): \[java] CommentDefaultAccessModifier should consider lombok's @Value * java-design * [#4188](https://github.com/pmd/pmd/issues/4188): \[java] ClassWithOnlyPrivateConstructorsShouldBeFinal false positive with Lombok's @NoArgsConstructor + * [#4189](https://github.com/pmd/pmd/issues/4189): \[java] AbstractClassWithoutAnyMethod should consider lombok's @AllArgsConstructor * [#4200](https://github.com/pmd/pmd/issues/4200): \[java] ClassWithOnlyPrivateConstructorsShouldBeFinal should consider lombok's @Value * java-errorprone * [#4185](https://github.com/pmd/pmd/issues/4185): \[java] InvalidLogMessageFormat rule produces a NPE diff --git a/pmd-java/src/main/resources/category/java/design.xml b/pmd-java/src/main/resources/category/java/design.xml index d326073a2b..db9d3eb645 100644 --- a/pmd-java/src/main/resources/category/java/design.xml +++ b/pmd-java/src/main/resources/category/java/design.xml @@ -31,7 +31,12 @@ protected constructor in order to prevent instantiation than make the class misl [@Abstract = true()] [not(./ClassOrInterfaceBody/*/ConstructorDeclaration)] [not(./ClassOrInterfaceBody/*/MethodDeclaration)] - [not(../Annotation/MarkerAnnotation/Name[pmd-java:typeIs('com.google.auto.value.AutoValue')])] + [not(../Annotation[pmd-java:typeIs('com.google.auto.value.AutoValue') + or pmd-java:typeIs('lombok.AllArgsConstructor') + or pmd-java:typeIs('lombok.NoArgsConstructor') + or pmd-java:typeIs('lombok.RequiredArgsConstructor') + ] + )] ]]> diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/design/xml/AbstractClassWithoutAnyMethod.xml b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/design/xml/AbstractClassWithoutAnyMethod.xml index 6536c4740e..17aa4d7d6d 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/design/xml/AbstractClassWithoutAnyMethod.xml +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/design/xml/AbstractClassWithoutAnyMethod.xml @@ -102,4 +102,32 @@ class Foo { } ]]> + + + [java] AbstractClassWithoutAnyMethod should consider lombok's @AllArgsConstructor #4189 + 0 + +