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 of nested classes #4082
Labels
a:false-positive
PMD flags a piece of code that is not problematic
Milestone
Comments
abyss638
added
the
a:false-positive
PMD flags a piece of code that is not problematic
label
Aug 5, 2022
abyss638
changed the title
[java] UnnecessaryImport false positive for on-demand imports of nested classses
[java] UnnecessaryImport false positive for on-demand imports of nested classes
Aug 5, 2022
4 tasks
adangel
added a commit
to adangel/pmd
that referenced
this issue
Aug 24, 2022
rdesgroppes
added a commit
to rdesgroppes/rules_jvm
that referenced
this issue
Apr 26, 2023
Currently shipped PMD version is at 6.46.0, released in May 2022. Since then, a handful of fixes & enhancements got released, among which: - pmd/pmd#3936 in 6.47.0 - pmd/pmd#4015 in 6.48.0 - pmd/pmd#4082 in 6.49.0 - pmd/pmd#4085 in 6.50.0 - pmd/pmd#4139 in 6.51.0 - pmd/pmd#4152 in 6.52.0 - pmd/pmd#4266 in 6.53.0 - pmd/pmd#4364 in 6.54.0 - pmd/pmd#4333 in 6.55.0 The latter also [states](https://docs.pmd-code.org/pmd-doc-6.55.0/pmd_release_notes.html#pmd-7-development) that: > This release is the last planned release of PMD 6. The first version > 6.0.0 was released in December 2017. Over the course of more than 5 > years we published almost every month a new minor version of PMD 6 > with new features and improvements. The present change therefore bumps the shipped PMD version to 6.55.0 so as to benefit from its last improvements, before envisioning an upgrade to PMD 7, [when ready](https://github.com/pmd/pmd/milestone/19). Closes bazel-contrib#176.
rdesgroppes
added a commit
to rdesgroppes/rules_jvm
that referenced
this issue
Apr 26, 2023
closes bazel-contrib#176. Currently shipped PMD version is at 6.46.0, released in May 2022. Since then, a handful of fixes & enhancements got released, among which: - pmd/pmd#3936 in 6.47.0 - pmd/pmd#4015 in 6.48.0 - pmd/pmd#4082 in 6.49.0 - pmd/pmd#4085 in 6.50.0 - pmd/pmd#4139 in 6.51.0 - pmd/pmd#4152 in 6.52.0 - pmd/pmd#4266 in 6.53.0 - pmd/pmd#4364 in 6.54.0 - pmd/pmd#4333 in 6.55.0 The latter also [states](https://docs.pmd-code.org/pmd-doc-6.55.0/pmd_release_notes.html#pmd-7-development) that: > This release is the last planned release of PMD 6. The first version > 6.0.0 was released in December 2017. Over the course of more than 5 > years we published almost every month a new minor version of PMD 6 > with new features and improvements. The present change therefore bumps the shipped PMD version to 6.55.0 so as to benefit from its last improvements, before envisioning an upgrade to PMD 7, [when ready](https://github.com/pmd/pmd/milestone/19).
illicitonion
pushed a commit
to bazel-contrib/rules_jvm
that referenced
this issue
Apr 26, 2023
closes #176. Currently shipped PMD version is at 6.46.0, released in May 2022. Since then, a handful of fixes & enhancements got released, among which: - pmd/pmd#3936 in 6.47.0 - pmd/pmd#4015 in 6.48.0 - pmd/pmd#4082 in 6.49.0 - pmd/pmd#4085 in 6.50.0 - pmd/pmd#4139 in 6.51.0 - pmd/pmd#4152 in 6.52.0 - pmd/pmd#4266 in 6.53.0 - pmd/pmd#4364 in 6.54.0 - pmd/pmd#4333 in 6.55.0 The latter also [states](https://docs.pmd-code.org/pmd-doc-6.55.0/pmd_release_notes.html#pmd-7-development) that: > This release is the last planned release of PMD 6. The first version > 6.0.0 was released in December 2017. Over the course of more than 5 > years we published almost every month a new minor version of PMD 6 > with new features and improvements. The present change therefore bumps the shipped PMD version to 6.55.0 so as to benefit from its last improvements, before envisioning an upgrade to PMD 7, [when ready](https://github.com/pmd/pmd/milestone/19).
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Affects PMD Version:
6.48.0 (but works fine in 5.8.1)
Rule:
UnnecessaryImports
Description:
Nested classes (non-static and static) can be imported using on-demand import and static nested classes can be imported with on-demand static import. For both cases PMD will show 'Unused import X.X.X`
Code Sample demonstrating the issue:
Expected outcome:
PMD reports a violation
Unused net.sourceforge.pmd.lang.java.rule.codestyle.unnecessaryimport.package2.C
, but that's wrong. That's a false positive.Running PMD through:
Ant
The text was updated successfully, but these errors were encountered: