Skip to content

[java] UnusedPrivateMethod false positive with generics #2890

@Adam-

Description

@Adam-

Affects PMD Version: 6.29.0

Rule: UnusedPrivateMethod

Please provide the rule name and a link to the rule documentation:
https://pmd.github.io/latest/pmd_rules_java_bestpractices.html#unusedprivatemethod

Description: See link to code below. The method is clearly being used a few lines above it (L807/808). If I had to guess probably something with the generics is throwing it off, since PMD has ran over the rest of the codebase okay.

Code Sample demonstrating the issue:

https://github.com/runelite/runelite/blob/7ceb3c9e020aa8316ddc5809a2d409d5d2efb697/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/MenuEntrySwapperPlugin.java#L811

Expected outcome:

PMD should not report sortedInsert as unused.

Running PMD through: [CLI | Ant | Maven | Gradle | Designer | Other] maven

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