diff --git a/docs/pages/release_notes.md b/docs/pages/release_notes.md index b8f8783555..3910997c70 100644 --- a/docs/pages/release_notes.md +++ b/docs/pages/release_notes.md @@ -16,9 +16,15 @@ This is a {{ site.pmd.release_type }} release. ### Fixed Issues +* pmd-java + * [#2708](https://github.com/pmd/pmd/pull/2708): \[java] False positive FinalFieldCouldBeStatic when using lombok Builder.Default + + ### API Changes ### External Contributions +* [#2747](https://github.com/pmd/pmd/pull/2747): \[java] Don't trigger FinalFieldCouldBeStatic when field is annotated with lombok @Builder.Default - [Ollie Abbey](https://github.com/ollieabbey) + {% endtocmaker %} diff --git a/pmd-java/src/main/resources/category/java/design.xml b/pmd-java/src/main/resources/category/java/design.xml index 0af388760f..5d7dfcb081 100644 --- a/pmd-java/src/main/resources/category/java/design.xml +++ b/pmd-java/src/main/resources/category/java/design.xml @@ -740,8 +740,11 @@ in each object at runtime. 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 ea8200e411..ebd108cc17 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 @@ -1,8 +1,8 @@ + xmlns="http://pmd.sourceforge.net/rule-tests" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://pmd.sourceforge.net/rule-tests http://pmd.sourceforge.net/rule-tests_1_0_0.xsd"> simple failure case @@ -98,6 +98,57 @@ interface Test { + + + + #2708 - False positive with lombok @Builder.Default fields + 0 + + + + + #2708 - Should trigger with non-lombok @Builder.Default fields + 1 + + + + + Should trigger multiple times for fields declared on one line + 2 +