Affects PMD Version: 6.50.0
Rule: UnnecessaryFullyQualifiedName
Description:
This happens with Apache Commons BCEL pinned at commit c757ff61a521ed5a44dca6444f3a91fa6d40b863
package org.apache.bcel.classfile; ... @java.lang.Deprecated protected int access_flags;
There is in the same package class called Deprecated
: org.apache.bcel.classfile.Deprecated
git clone https://github.com/apache/commons-bcel.git
cd commons-bcel
git checkout c757ff61a521ed5a44dca6444f3a91fa6d40b863
mvn pmd:check
cat target/pmd.xml
Expected outcome:
PMD reports many violation at line starting with 31 of src\main\java\org\apache\bcel\classfile\AccessFlags.java
, for example, but that's wrong. That's a false positive.
The first false positive is:
<file name="C:\Users\ggregory\git\a\commons-bcel\src\main\java\org\apache\bcel\classfile\AccessFlags.java">
<violation beginline="31" endline="31" begincolumn="6" endcolumn="25" rule="UnnecessaryFullyQualifiedName" ruleset="Code Style" package="org.apache.bcel.classfile" class="AccessFlags" externalInfoUrl="https://pmd.github.io/pmd-6.50.0/pmd_rules_java_codestyle.html#unnecessaryfullyqualifiedname" priority="4">
Unnecessary use of fully qualified name 'java.lang.Deprecated' due to existing implicit import 'java.lang.*'
</violation>
</file>
The package declares a class org.apache.bcel.classfile.Deprecated
and classes in this also package use @java.lang.Deprecated
with its FQCN.
There are many other instances of this false-positive in the package org.apache.bcel.classfile
.
Running PMD through: Maven
Apache Maven 3.8.6 (84538c9988a25aec085021c365c560670ad80f63)
Maven home: C:\java\apache-maven-3.8.6
Java version: 1.8.0_345, vendor: Temurin, runtime: C:\Program Files\Eclipse Adoptium\jdk-8.0.345.1-hotspot\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"
Microsoft Windows [Version 10.0.19043.2006]
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