A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/pmd/pmd/issues/4140 below:

[java] [doc] AccessorClassGeneration violations hidden with Java 11 · Issue #4140 · pmd/pmd · GitHub

Identified at checkstyle/checkstyle#12241

Affects PMD Version:

6.50.0

Rule:

AccessorClassGeneration
https://pmd.github.io/latest/pmd_rules_java_bestpractices.html#accessorclassgeneration

Description:

AccessorClassGeneration produces no violations on our repo when specifying Java 11, but does when it is switched to Java 10 and no other changes are made.

Code Sample demonstrating the issue:

Clone https://github.com/checkstyle/checkstyle and check out commit b6f2551a9722fabca5d7bae25f6feab01fa77644 .

Run mvn clean pmd:check and no violations are reported. Clean repo specifies Java 11.

Apply the following changes which just changes PMD's JDK version to below 11:

diff --git a/pom.xml b/pom.xml
index 1422adb..3164b46 100644
--- a/pom.xml
+++ b/pom.xml
@@ -502,7 +502,7 @@
           <version>${maven.pmd.plugin.version}</version>
           <configuration>
             <analysisCache>true</analysisCache>
-            <targetJdk>${java.version}</targetJdk>
+            <targetJdk>10</targetJdk>
             <minimumTokens>20</minimumTokens>
             <skipEmptyReport>false</skipEmptyReport>
             <failOnViolation>true</failOnViolation>

Run mvn clean pmd:check and the following violations are shown:

[INFO] --- maven-pmd-plugin:3.19.0:check (default-cli) @ checkstyle ---
[INFO] PMD version: 6.50.0
[INFO] PMD Failure: com.puppycrawl.tools.checkstyle.internal.ArchUnitSuperClassTest:87 Rule:AccessorClassGeneration Priority:3 Avoid instantiation through private constructors from outside of the constructors class..
[INFO] PMD Failure: com.puppycrawl.tools.checkstyle.internal.ArchUnitSuperClassTest:109 Rule:AccessorClassGeneration Priority:3 Avoid instantiation through private constructors from outside of the constructors class..
[INFO] PMD Failure: com.puppycrawl.tools.checkstyle.internal.ImmutabilityTest:209 Rule:AccessorClassGeneration Priority:3 Avoid instantiation through private constructors from outside of the constructors class..
[INFO] PMD Failure: com.puppycrawl.tools.checkstyle.internal.ImmutabilityTest:215 Rule:AccessorClassGeneration Priority:3 Avoid instantiation through private constructors from outside of the constructors class..
[INFO] PMD Failure: com.puppycrawl.tools.checkstyle.internal.ImmutabilityTest:235 Rule:AccessorClassGeneration Priority:3 Avoid instantiation through private constructors from outside of the constructors class..
[INFO] PMD Failure: com.puppycrawl.tools.checkstyle.internal.ImmutabilityTest:257 Rule:AccessorClassGeneration Priority:3 Avoid instantiation through private constructors from outside of the constructors class..
[INFO] PMD Failure: com.puppycrawl.tools.checkstyle.internal.ImmutabilityTest:259 Rule:AccessorClassGeneration Priority:3 Avoid instantiation through private constructors from outside of the constructors class..
[INFO] PMD Failure: com.puppycrawl.tools.checkstyle.internal.ImmutabilityTest:280 Rule:AccessorClassGeneration Priority:3 Avoid instantiation through private constructors from outside of the constructors class..
[INFO] PMD Failure: com.puppycrawl.tools.checkstyle.internal.ImmutabilityTest:300 Rule:AccessorClassGeneration Priority:3 Avoid instantiation through private constructors from outside of the constructors class..

Expected outcome:

PMD should report the violations suggested regardless of Java version as they seem to be valid for the rule.

Running PMD through: Maven


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4