diff --git a/pmd-java/src/main/resources/category/java/design.xml b/pmd-java/src/main/resources/category/java/design.xml index 7f71b9356c..e1a944b912 100644 --- a/pmd-java/src/main/resources/category/java/design.xml +++ b/pmd-java/src/main/resources/category/java/design.xml @@ -742,7 +742,8 @@ in each object at runtime. [@Final= true() and @Static= false()] [VariableDeclarator/VariableInitializer/Expression /PrimaryExpression[not(PrimarySuffix)]/PrimaryPrefix/Literal] -[not(preceding-sibling::Annotation/MarkerAnnotation/Name[@Image="Builder.Default"])] + [not(preceding-sibling::Annotation/MarkerAnnotation/Name[@Image="Builder.Default"] + and //ImportDeclaration/Name[@Image="lombok.Builder"])] ]]> diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/design/xml/FinalFieldCouldBeStatic.xml b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/design/xml/FinalFieldCouldBeStatic.xml index ac7d3db35b..7df1479d54 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/design/xml/FinalFieldCouldBeStatic.xml +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/design/xml/FinalFieldCouldBeStatic.xml @@ -103,7 +103,7 @@ public @interface MetricType { - #2708 - False positive with @Builder.Default fields + #2708 - False positive with lombok @Builder.Default fields 0 + + + + #2708 - Should trigger with non-lombok @Builder.Default fields + 1 +