Skip to content

[java] UseProperClassLoader false positive #3173

@hgschmie

Description

@hgschmie

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    a:false-positivePMD flags a piece of code that is not problematic

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions