From 4a805f4284d47b6a660e8cfca719f67056fb2d29 Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Thu, 17 Mar 2022 11:14:54 +0100 Subject: [PATCH] [java] Fix ClassWithOnlyPrivateConstructorsShouldBeFinal with multiple classes Fixes #3851 --- docs/pages/release_notes.md | 2 ++ .../src/main/resources/category/java/design.xml | 16 +++++++++++----- ...sWithOnlyPrivateConstructorsShouldBeFinal.xml | 15 +++++++++++++++ 3 files changed, 28 insertions(+), 5 deletions(-) diff --git a/docs/pages/release_notes.md b/docs/pages/release_notes.md index ae817d64cb..2e198cd082 100644 --- a/docs/pages/release_notes.md +++ b/docs/pages/release_notes.md @@ -57,6 +57,8 @@ The CLI itself remains compatible, if you run PMD via command-line, no action is * [#3299](https://github.com/pmd/pmd/issues/3299): \[core] Deprecate system properties of PMDCommandLineInterface * doc * [#3812](https://github.com/pmd/pmd/issues/3812): \[doc] Documentation website table of contents broken on pages with many subheadings +* java-design + * [#3851](https://github.com/pmd/pmd/issues/3851): \[java] ClassWithOnlyPrivateConstructorsShouldBeFinal - false negative when a compilation unit contains two class declarations ### API Changes diff --git a/pmd-java/src/main/resources/category/java/design.xml b/pmd-java/src/main/resources/category/java/design.xml index 1b30305f92..f071a261f9 100644 --- a/pmd-java/src/main/resources/category/java/design.xml +++ b/pmd-java/src/main/resources/category/java/design.xml @@ -338,11 +338,17 @@ is invoked by a inner class. diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/design/xml/ClassWithOnlyPrivateConstructorsShouldBeFinal.xml b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/design/xml/ClassWithOnlyPrivateConstructorsShouldBeFinal.xml index f7c9e75d8b..8d6ffe733b 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/design/xml/ClassWithOnlyPrivateConstructorsShouldBeFinal.xml +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/design/xml/ClassWithOnlyPrivateConstructorsShouldBeFinal.xml @@ -170,6 +170,21 @@ public class Outer { private abstract class Base { private void run() {} } +} + ]]> + + + + [java] ClassWithOnlyPrivateConstructorsShouldBeFinal - false negative when a compilation unit contains two class declarations #3851 + 1 + 1 +