PMD xpath是否要抑制AtlastoneConstructor和UnusedPrivateField?

PMD xpath是否要抑制AtlastoneConstructor和UnusedPrivateField?,xpath,pmd,Xpath,Pmd,我有这段代码,PMD报告了两个违反规则的情况: AbstractExceptionHandler没有构造函数(AtlastoneConstructor) uriInfo字段是一个未使用的私有字段(UnusedPrivateField) 这两个警告都可以,但我们使用注释生成代码。所以这个警告对我们来说是无用的 我们创建了以下抑制: AtlastoneConstructor <rule ref="rulesets/java/controversial.xml/AtLeastOneConstru

我有这段代码,PMD报告了两个违反规则的情况:

AbstractExceptionHandler没有构造函数(AtlastoneConstructor)

uriInfo字段是一个未使用的私有字段(UnusedPrivateField)

这两个警告都可以,但我们使用注释生成代码。所以这个警告对我们来说是无用的

我们创建了以下抑制:

AtlastoneConstructor

<rule ref="rulesets/java/controversial.xml/AtLeastOneConstructor">
    <properties>
        <property name="violationSuppressXPath"
            value="//ClassOrInterfaceDeclaration[//ImportDeclaration//Name[@Image='lombok.NoArgsConstructor'] | //TypeDeclaration//MarkerAnnotation//Name[@Image='NoArgsConstructor']]" />
    </properties>
</rule>

UnusedPrivateField

<rule ref="rulesets/java/unusedcode.xml/UnusedPrivateField">
    <properties>
        <property name="violationSuppressXPath"
            value="//ClassOrInterfaceBodyDeclaration//FieldDeclaration[//TypeDeclaration//MarkerAnnotation//Name[@Image='Getter'] | //TypeDeclaration//MarkerAnnotation//Name[@Image='Setter']]"/>
    </properties>
</rule>

PMD xpath设计器告诉我们,这正是发生冲突时使用的行,但PMD仍然报告错误。 有人能帮我走出黑暗吗

<rule ref="rulesets/java/unusedcode.xml/UnusedPrivateField">
    <properties>
        <property name="violationSuppressXPath"
            value="//ClassOrInterfaceBodyDeclaration//FieldDeclaration[//TypeDeclaration//MarkerAnnotation//Name[@Image='Getter'] | //TypeDeclaration//MarkerAnnotation//Name[@Image='Setter']]"/>
    </properties>
</rule>