From a1bcad2db2ccece6401b0dfae5ce5a983d1410c5 Mon Sep 17 00:00:00 2001 From: LynnBroe Date: Wed, 5 Oct 2022 13:54:41 +0800 Subject: [PATCH] fix #4141 --- .../resources/category/java/documentation.xml | 5 +++- .../xml/UncommentedEmptyConstructor.xml | 26 +++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/pmd-java/src/main/resources/category/java/documentation.xml b/pmd-java/src/main/resources/category/java/documentation.xml index 9081295102..8a331af2e6 100644 --- a/pmd-java/src/main/resources/category/java/documentation.xml +++ b/pmd-java/src/main/resources/category/java/documentation.xml @@ -102,7 +102,10 @@ and unintentional empty constructors. [@containsComment = false()] [not(BlockStatement)] [$ignoreExplicitConstructorInvocation = true() or not(ExplicitConstructorInvocation)] - [not(../Annotation/MarkerAnnotation/Name[pmd-java:typeIs('javax.inject.Inject')])] + [not(../Annotation/MarkerAnnotation/Name[ + pmd-java:typeIs('javax.inject.Inject') + or pmd-java:typeIs('org.springframework.beans.factory.annotation.Autowired') + ])] ]]> diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/documentation/xml/UncommentedEmptyConstructor.xml b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/documentation/xml/UncommentedEmptyConstructor.xml index 2d11209715..6ca1de2d16 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/documentation/xml/UncommentedEmptyConstructor.xml +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/documentation/xml/UncommentedEmptyConstructor.xml @@ -187,4 +187,30 @@ public class MyClass { } ]]> + + + #4141 UncommentedEmptyConstructor FP when annotated constructor with @Autowired + 0 + + + + + #4141 UncommentedEmptyConstructor FP when annotated constructor with @Autowired + 0 + + +