-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[java] UnnecessaryImport false positive for on-demand imports #2655
Labels
a:false-positive
PMD flags a piece of code that is not problematic
Milestone
Comments
adangel
added
a:false-positive
PMD flags a piece of code that is not problematic
and removed
a:bug
PMD crashes or fails to analyse a file.
labels
Aug 23, 2020
I'm afraid the new, replacement UnnecessaryImport rule reports the same FP. |
oowekyala
changed the title
[java] UnusedImports false positive for on-demand imports
[java] UnnecessaryImport false positive for on-demand imports
Apr 24, 2021
4 tasks
Still happening for this config: ...
<properties>
<java.version>11</java.version>
<pmdVersion>6.41.0</pmdVersion>
</properties>
<build>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-pmd-plugin</artifactId>
<version>3.15.0</version>
<executions>
<execution>
<id>pmd-while-compiling</id>
<phase>validate</phase>
<goals>
<goal>check</goal>
</goals>
<configuration>
<printFailingErrors>true</printFailingErrors>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>net.sourceforge.pmd</groupId>
<artifactId>pmd-core</artifactId>
<version>${pmdVersion}</version>
</dependency>
<dependency>
<groupId>net.sourceforge.pmd</groupId>
<artifactId>pmd-java</artifactId>
<version>${pmdVersion}</version>
</dependency>
<dependency>
<groupId>net.sourceforge.pmd</groupId>
<artifactId>pmd-javascript</artifactId>
<version>${pmdVersion}</version>
</dependency>
<dependency>
<groupId>net.sourceforge.pmd</groupId>
<artifactId>pmd-jsp</artifactId>
<version>${pmdVersion}</version>
</dependency>
</dependencies>
</plugin>
</build>
... |
@jonybuzz Can you please provide a code example? We have a passing regression test for this issue in our sources... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Affects PMD Version:
6.256.34.0 (this ticket was originally for UnusedImports, replaced by UnnecessaryImport)Rule:
UnnecessaryImports
Description:
Used IMO star-import reported as
Code Sample demonstrating the issue:
maven project with:
Expected outcome:
No violation reported, as
p.C.V
is resolved fromp.*
.Does PMD report a violation, where there shouldn't be one? -> false-positive
Yes it does.
Is PMD missing to report a violation, where there should be one? -> false-negative
No.
Running PMD through:
maven
Similar open issues, but reported for JavaDoc usage of import, while I observe it with code
Similar and closed
But with 6.20.0 I also experience violation in my case.
It's possible I'm doing something wrong.
The text was updated successfully, but these errors were encountered: