[MPMD-343] - Upgrade to PMD 6.46.0
diff --git a/pom.xml b/pom.xml
index a4e8bba..57197f5 100644
--- a/pom.xml
+++ b/pom.xml
@@ -89,7 +89,7 @@
<doxiaVersion>1.11.1</doxiaVersion>
<doxiaSitetoolsVersion>1.11.1</doxiaSitetoolsVersion>
<javaVersion>8</javaVersion><!-- Because PMD 6.35.0+ requires Java 8 -->
- <pmdVersion>6.45.0</pmdVersion>
+ <pmdVersion>6.46.0</pmdVersion>
<slf4jVersion>1.7.36</slf4jVersion>
<sitePluginVersion>3.12.0</sitePluginVersion>
<projectInfoReportsPluginVersion>3.3.0</projectInfoReportsPluginVersion>
@@ -253,8 +253,8 @@
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
- <version>2.6</version>
- <!-- scope>test</scope> Required by PMD transitively. -->
+ <version>2.11.0</version>
+ <scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
diff --git a/src/it/mpmd-138/verify.groovy b/src/it/mpmd-138/verify.groovy
index 5bdc44d..0a3a32b 100644
--- a/src/it/mpmd-138/verify.groovy
+++ b/src/it/mpmd-138/verify.groovy
@@ -22,7 +22,7 @@
assert buildLog.exists()
// Module 1
-assert 1 == buildLog.getText().count('[INFO] PMD Failure: test.MyClass:27 Rule:EmptyStatementNotInLoop Priority:3 An empty statement (semicolon) not part of a loop')
+assert 1 == buildLog.getText().count('[INFO] PMD Failure: test.MyClass:27 Rule:UnnecessarySemicolon Priority:3 Unnecessary semicolon')
assert 1 == buildLog.getText().count('[INFO] PMD Failure: test.MyClass:28 Rule:UnnecessaryReturn Priority:3 Avoid unnecessary return statements')
assert 1 == buildLog.getText().count('[INFO] You have 2 PMD violations. For more details see:')
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 912089a..238e51b 100644
--- a/src/main/resources/rulesets/java/maven-pmd-plugin-default.xml
+++ b/src/main/resources/rulesets/java/maven-pmd-plugin-default.xml
@@ -40,6 +40,7 @@
<rule ref="category/java/bestpractices.xml/UnusedPrivateField" />
<rule ref="category/java/bestpractices.xml/UnusedPrivateMethod" />
+ <rule ref="category/java/codestyle.xml/EmptyControlStatement" />
<rule ref="category/java/codestyle.xml/ExtendsObject" />
<rule ref="category/java/codestyle.xml/ForLoopShouldBeWhileLoop" />
<rule ref="category/java/codestyle.xml/TooManyStaticImports" />
@@ -47,6 +48,7 @@
<rule ref="category/java/codestyle.xml/UnnecessaryImport" />
<rule ref="category/java/codestyle.xml/UnnecessaryModifier" />
<rule ref="category/java/codestyle.xml/UnnecessaryReturn" />
+ <rule ref="category/java/codestyle.xml/UnnecessarySemicolon" />
<rule ref="category/java/codestyle.xml/UselessParentheses" />
<rule ref="category/java/codestyle.xml/UselessQualifiedThis" />
@@ -63,15 +65,6 @@
<rule ref="category/java/errorprone.xml/ClassCastExceptionWithToArray" />
<rule ref="category/java/errorprone.xml/DontUseFloatTypeForLoopIndices" />
<rule ref="category/java/errorprone.xml/EmptyCatchBlock" />
- <rule ref="category/java/errorprone.xml/EmptyFinallyBlock" />
- <rule ref="category/java/errorprone.xml/EmptyIfStmt" />
- <rule ref="category/java/errorprone.xml/EmptyInitializer" />
- <rule ref="category/java/errorprone.xml/EmptyStatementBlock" />
- <rule ref="category/java/errorprone.xml/EmptyStatementNotInLoop" />
- <rule ref="category/java/errorprone.xml/EmptySwitchStatements" />
- <rule ref="category/java/errorprone.xml/EmptySynchronizedBlock" />
- <rule ref="category/java/errorprone.xml/EmptyTryBlock" />
- <rule ref="category/java/errorprone.xml/EmptyWhileStmt" />
<rule ref="category/java/errorprone.xml/JumbledIncrementer" />
<rule ref="category/java/errorprone.xml/MisplacedNullCheck" />
<rule ref="category/java/errorprone.xml/OverrideBothEqualsAndHashcode" />
diff --git a/src/main/resources/rulesets/maven.xml b/src/main/resources/rulesets/maven.xml
index aab8afe..e4ab806 100644
--- a/src/main/resources/rulesets/maven.xml
+++ b/src/main/resources/rulesets/maven.xml
@@ -41,6 +41,7 @@
<rule ref="category/java/bestpractices.xml/UnusedPrivateField" />
<rule ref="category/java/bestpractices.xml/UnusedPrivateMethod" />
+ <rule ref="category/java/codestyle.xml/EmptyControlStatement" />
<rule ref="category/java/codestyle.xml/ExtendsObject" />
<rule ref="category/java/codestyle.xml/ForLoopShouldBeWhileLoop" />
<rule ref="category/java/codestyle.xml/TooManyStaticImports" />
@@ -48,6 +49,7 @@
<rule ref="category/java/codestyle.xml/UnnecessaryImport" />
<rule ref="category/java/codestyle.xml/UnnecessaryModifier" />
<rule ref="category/java/codestyle.xml/UnnecessaryReturn" />
+ <rule ref="category/java/codestyle.xml/UnnecessarySemicolon" />
<rule ref="category/java/codestyle.xml/UselessParentheses" />
<rule ref="category/java/codestyle.xml/UselessQualifiedThis" />
@@ -68,15 +70,6 @@
<property name="allowCommentedBlocks" value="true"/>
</properties>
</rule>
- <rule ref="category/java/errorprone.xml/EmptyFinallyBlock" />
- <rule ref="category/java/errorprone.xml/EmptyIfStmt" />
- <rule ref="category/java/errorprone.xml/EmptyInitializer" />
- <rule ref="category/java/errorprone.xml/EmptyStatementBlock" />
- <rule ref="category/java/errorprone.xml/EmptyStatementNotInLoop" />
- <rule ref="category/java/errorprone.xml/EmptySwitchStatements" />
- <rule ref="category/java/errorprone.xml/EmptySynchronizedBlock" />
- <rule ref="category/java/errorprone.xml/EmptyTryBlock" />
- <rule ref="category/java/errorprone.xml/EmptyWhileStmt" />
<rule ref="category/java/errorprone.xml/JumbledIncrementer" />
<rule ref="category/java/errorprone.xml/MisplacedNullCheck" />
<rule ref="category/java/errorprone.xml/OverrideBothEqualsAndHashcode" />
diff --git a/src/site/apt/examples/upgrading-PMD-at-runtime.apt.vm b/src/site/apt/examples/upgrading-PMD-at-runtime.apt.vm
index 2f80a2b..2bb5762 100644
--- a/src/site/apt/examples/upgrading-PMD-at-runtime.apt.vm
+++ b/src/site/apt/examples/upgrading-PMD-at-runtime.apt.vm
@@ -88,7 +88,7 @@
*--------------------------------------------------------------------------------*--------------------------------------------------*
| <<maven-pmd-plugin>> | <<PMD>> |
*--------------------------------------------------------------------------------*--------------------------------------------------*
-| {{{https://maven.apache.org/plugins-archives/maven-pmd-plugin-3.17.0/}3.17.0}} | {{{https://pmd.github.io/pmd-6.45.0/}6.45.0}} |
+| {{{https://maven.apache.org/plugins-archives/maven-pmd-plugin-3.17.0/}3.17.0}} | {{{https://pmd.github.io/pmd-6.46.0/}6.46.0}} |
*--------------------------------------------------------------------------------*--------------------------------------------------*
| {{{https://maven.apache.org/plugins-archives/maven-pmd-plugin-3.16.0/}3.16.0}} | {{{https://pmd.github.io/pmd-6.42.0/}6.42.0}} |
*--------------------------------------------------------------------------------*--------------------------------------------------*
diff --git a/src/site/apt/examples/usingRuleSets.apt.vm b/src/site/apt/examples/usingRuleSets.apt.vm
index cf5ac84..7870511 100644
--- a/src/site/apt/examples/usingRuleSets.apt.vm
+++ b/src/site/apt/examples/usingRuleSets.apt.vm
@@ -102,6 +102,7 @@
<rule ref="category/java/bestpractices.xml/UnusedPrivateField" />
<rule ref="category/java/bestpractices.xml/UnusedPrivateMethod" />
+ <rule ref="category/java/codestyle.xml/EmptyControlStatement" />
<rule ref="category/java/codestyle.xml/ExtendsObject" />
<rule ref="category/java/codestyle.xml/ForLoopShouldBeWhileLoop" />
<rule ref="category/java/codestyle.xml/TooManyStaticImports" />
@@ -109,6 +110,7 @@
<rule ref="category/java/codestyle.xml/UnnecessaryImport" />
<rule ref="category/java/codestyle.xml/UnnecessaryModifier" />
<rule ref="category/java/codestyle.xml/UnnecessaryReturn" />
+ <rule ref="category/java/codestyle.xml/UnnecessarySemicolon" />
<rule ref="category/java/codestyle.xml/UselessParentheses" />
<rule ref="category/java/codestyle.xml/UselessQualifiedThis" />
@@ -125,15 +127,6 @@
<rule ref="category/java/errorprone.xml/ClassCastExceptionWithToArray" />
<rule ref="category/java/errorprone.xml/DontUseFloatTypeForLoopIndices" />
<rule ref="category/java/errorprone.xml/EmptyCatchBlock" />
- <rule ref="category/java/errorprone.xml/EmptyFinallyBlock" />
- <rule ref="category/java/errorprone.xml/EmptyIfStmt" />
- <rule ref="category/java/errorprone.xml/EmptyInitializer" />
- <rule ref="category/java/errorprone.xml/EmptyStatementBlock" />
- <rule ref="category/java/errorprone.xml/EmptyStatementNotInLoop" />
- <rule ref="category/java/errorprone.xml/EmptySwitchStatements" />
- <rule ref="category/java/errorprone.xml/EmptySynchronizedBlock" />
- <rule ref="category/java/errorprone.xml/EmptyTryBlock" />
- <rule ref="category/java/errorprone.xml/EmptyWhileStmt" />
<rule ref="category/java/errorprone.xml/JumbledIncrementer" />
<rule ref="category/java/errorprone.xml/MisplacedNullCheck" />
<rule ref="category/java/errorprone.xml/OverrideBothEqualsAndHashcode" />
diff --git a/src/site/markdown/releasenotes.md b/src/site/markdown/releasenotes.md
index 87224d8..2c7cd46 100644
--- a/src/site/markdown/releasenotes.md
+++ b/src/site/markdown/releasenotes.md
@@ -52,6 +52,7 @@
* [MPMD-339](https://issues.apache.org/jira/browse/MPMD-339) - Upgrade plugins in ITs
* [MPMD-340](https://issues.apache.org/jira/browse/MPMD-340) - Upgrade Maven Reporting API/Impl to 3.1.0
* [MPMD-341](https://issues.apache.org/jira/browse/MPMD-341) - Upgrade Maven Plugin Test Harness to 3.3.0
+* [MPMD-343](https://issues.apache.org/jira/browse/MPMD-343) - Upgrade to PMD 6.46.0
## Version 3.16.0