This commit is contained in:
LynnBroe 2022-10-05 13:54:41 +08:00
parent 905f1432f4
commit a1bcad2db2
2 changed files with 30 additions and 1 deletions

View File

@ -102,7 +102,10 @@ and unintentional empty constructors.
[@containsComment = false()] [@containsComment = false()]
[not(BlockStatement)] [not(BlockStatement)]
[$ignoreExplicitConstructorInvocation = true() or not(ExplicitConstructorInvocation)] [$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')
])]
]]> ]]>
</value> </value>
</property> </property>

View File

@ -187,4 +187,30 @@ public class MyClass {
} }
]]></code> ]]></code>
</test-code> </test-code>
<test-code>
<description>#4141 UncommentedEmptyConstructor FP when annotated constructor with @Autowired</description>
<expected-problems>0</expected-problems>
<code><![CDATA[
import org.springframework.beans.factory.annotation.Autowired;
public class Bug {
@Autowired
public Bug() {
}
}
]]></code>
</test-code>
<test-code>
<description>#4141 UncommentedEmptyConstructor FP when annotated constructor with @Autowired</description>
<expected-problems>0</expected-problems>
<code><![CDATA[
public class Bug {
@org.springframework.beans.factory.annotation.Autowired
public Bug() {
}
}
]]></code>
</test-code>
</test-data> </test-data>