From 38701dab48b91e9a44611b7cf5b586a7778a6439 Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Thu, 2 Sep 2021 10:10:45 +0200 Subject: [PATCH] [MPMD-312] The rule BooleanInstantiation is deprecated Since PMD 6.37.0, BooleanInstantiation is deprecated. The new rule PrimitiveWrapperInstantiation should be used instead. Also exclude asm:asm, as pmd brings in a newer version as org.ow2.asm:asm --- pom.xml | 7 +++++++ .../resources/rulesets/java/maven-pmd-plugin-default.xml | 2 +- src/main/resources/rulesets/maven.xml | 2 +- src/site/apt/examples/usingRuleSets.apt.vm | 2 +- .../java/org/apache/maven/plugins/pmd/PmdReportTest.java | 6 ++++++ 5 files changed, 16 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index 7fcf25ab..c5ccdee9 100644 --- a/pom.xml +++ b/pom.xml @@ -138,6 +138,13 @@ under the License. maven-embedder 3.1.0 provided + + + + asm + asm + + diff --git a/src/main/resources/rulesets/java/maven-pmd-plugin-default.xml b/src/main/resources/rulesets/java/maven-pmd-plugin-default.xml index 7604fdc8..912089a9 100644 --- a/src/main/resources/rulesets/java/maven-pmd-plugin-default.xml +++ b/src/main/resources/rulesets/java/maven-pmd-plugin-default.xml @@ -34,6 +34,7 @@ under the License. + @@ -85,6 +86,5 @@ under the License. - diff --git a/src/main/resources/rulesets/maven.xml b/src/main/resources/rulesets/maven.xml index 4386fdf6..aab8afe3 100644 --- a/src/main/resources/rulesets/maven.xml +++ b/src/main/resources/rulesets/maven.xml @@ -35,6 +35,7 @@ under the License. + @@ -90,6 +91,5 @@ under the License. - diff --git a/src/site/apt/examples/usingRuleSets.apt.vm b/src/site/apt/examples/usingRuleSets.apt.vm index 51cc118d..cf5ac843 100644 --- a/src/site/apt/examples/usingRuleSets.apt.vm +++ b/src/site/apt/examples/usingRuleSets.apt.vm @@ -96,6 +96,7 @@ The default ruleset +-----+ + @@ -147,5 +148,4 @@ The default ruleset - +-----+ diff --git a/src/test/java/org/apache/maven/plugins/pmd/PmdReportTest.java b/src/test/java/org/apache/maven/plugins/pmd/PmdReportTest.java index 7e175a94..5fa29529 100644 --- a/src/test/java/org/apache/maven/plugins/pmd/PmdReportTest.java +++ b/src/test/java/org/apache/maven/plugins/pmd/PmdReportTest.java @@ -105,6 +105,12 @@ public void testDefaultConfiguration() assertTrue( str.contains( "Priority 4" ) ); // the file App.java is mentioned 3 times: in prio 3, in prio 4 and in the files section assertEquals( 3, StringUtils.countMatches( str, "def/configuration/App.java" ) ); + + // there must be no warnings (like deprecated rules) in the log output + String output = CapturingPrintStream.getOutput(); + assertFalse( output.contains( "deprecated Rule name" ) ); + assertFalse( output.contains( "Discontinue using Rule name" ) ); + assertFalse( output.contains( "is referenced multiple times" ) ); } public void testDefaultConfigurationNotRenderRuleViolationPriority()