Skip to content
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] UseProperClassLoader false positive #3173

Closed
hgschmie opened this issue Mar 26, 2021 · 1 comment · Fixed by #3477
Closed

[java] UseProperClassLoader false positive #3173

hgschmie opened this issue Mar 26, 2021 · 1 comment · Fixed by #3477
Labels
a:false-positive PMD flags a piece of code that is not problematic
Projects
Milestone

Comments

@hgschmie
Copy link
Contributor

hgschmie commented Mar 26, 2021

Rule UseProperClassLoader

Affects PMD Version:
6.32.0 (should be all versions since 3.7)

Make sure, to test with the latest PMD version.

Description:

The UseProperClassLoader will match any method called getClassLoader(), not just java.lang.Class.getClassLoader, e.g. https://javadoc.io/static/io.dropwizard/dropwizard-core/2.0.20/io/dropwizard/setup/Bootstrap.html#getClassLoader--

Steps to reproduce:

Please provide detailed steps for how we can reproduce the bug.

  1. ... use a dropwizard project, then call bootstrap.getClassLoader() in the initialize method of a dropwizard app, run pmd on it.
  2. ... run pmd on the project (maven or command line)
@hgschmie hgschmie added the a:bug PMD crashes or fails to analyse a file. label Mar 26, 2021
@oowekyala oowekyala added the in:type-resolution Affects the type resolution code label Apr 8, 2021
@oowekyala oowekyala changed the title [java] UseClassLoader false positive [java] UseProperClassLoader false positive May 6, 2021
@oowekyala oowekyala added a:false-positive PMD flags a piece of code that is not problematic and removed in:type-resolution Affects the type resolution code a:bug PMD crashes or fails to analyse a file. labels May 6, 2021
@adangel adangel added this to the 7.0.0 milestone Aug 20, 2021
@adangel adangel linked a pull request Aug 20, 2021 that will close this issue
@adangel adangel added this to Done in PMD 7 Aug 20, 2021
adangel added a commit to adangel/pmd that referenced this issue Aug 20, 2021
@adangel adangel mentioned this issue Jan 23, 2023
55 tasks
@adangel
Copy link
Member

adangel commented Apr 22, 2023

This has been fixed with PMD 7.0.0-rc1.

@adangel adangel closed this as completed Apr 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a:false-positive PMD flags a piece of code that is not problematic
Projects
No open projects
PMD 7
  
Done
Development

Successfully merging a pull request may close this issue.

3 participants