GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — [java] UnusedPrivateMethod: False positive with raw type for generic method · Issue #6028 · pmd/pmd

[java] UnusedPrivateMethod: False positive with raw type for generic method #6028

New issue
Copy link
New issue
Copy link
Closed
#6294
Closed
[java] UnusedPrivateMethod: False positive with raw type for generic method#6028
#6294
Copy link
Labels
a:false-positivePMD flags a piece of code that is not problematic
Milestone
7.20.0

Description

@Pankraz76
Pankraz76
opened on Aug 31, 2025
Issue body actions

Affects PMD Version: PMD 7.14.0

Rule: UnusedPrivateMethod

Description:

Code Sample demonstrating the issue:

import java.util.Collection;

public final class addAllImpl {
  private static abstract class Multiset<K> extends Collection<K> { }
  static <E> boolean addAllImpl(
      Multiset<E> self, Collection<?> elements) {
    return addAllImpl(self, (Multiset) elements);
  }

  private static <E> boolean addAllImpl(
      Multiset<E> self, Multiset<E> elements) {
  }
}

Expected outcome:

PMD reports a violation at line 10, but that's wrong. That's a false positive.

Running PMD through: maven-pmd-plugin 3.27.0

Activity

  1. Pankraz76
    added
    a:false-positivePMD flags a piece of code that is not problematic
    on Aug 31, 2025
  2. UncleOwen commented on Aug 31, 2025

    @UncleOwen
    UncleOwen
    on Aug 31, 2025
    Member
    More actions

    Your issues are extremely difficult to read. Please

    • Shorten your code samples so that they clearly demonstrate the issue.
    • Use the provided template as it is intended. You managed to fill in every single part wrong.
  3. Pankraz76 commented on Aug 31, 2025

    @Pankraz76
    Pankraz76
    on Aug 31, 2025
    ContributorAuthor
    More actions
    • You managed to fill in every single part wrong.

    its just the template, right?

    updated the test data

  4. UncleOwen commented on Aug 31, 2025

    @UncleOwen
    UncleOwen
    on Aug 31, 2025
    Member
    More actions

    If you want unreadable issues, it's "just" the template. Otherwise, it's a helpful tool to structure information.

  5. Pankraz76 commented on Sep 1, 2025

    @Pankraz76
    Pankraz76
    on Sep 1, 2025
    ContributorAuthor
    More actions

    yes you right, sorry.

    Actually provided key information which is the recipe name and the test code thats all needed to reproduce.

    Anything else is considered obsolete from my point of view.

  6. zbynek commented on Sep 1, 2025

    @zbynek
    zbynek
    on Sep 1, 2025
    Contributor
    More actions

    The testcase can be simplified by removing the imports:

    import java.util.Collection;
    
    public final class addAllImpl {
      private static abstract class Multiset<K> extends Collection<K> { }
      static <E> boolean addAllImpl(
          Multiset<E> self, Collection<?> elements) {
        return addAllImpl(self, (Multiset) elements);
      }
    
      private static <E> boolean addAllImpl(
          Multiset<E> self, Multiset<E> elements) {
      }
    }

    Looks like overload resolution is not working well in a particular case involving generics.

    Reacted by Vincent Potuček and Andreas Dangel
  7. oowekyala commented on Sep 1, 2025

    @oowekyala
    oowekyala
    on Sep 1, 2025
    Member
    More actions

    Yes this looks like it's related to raw types. Maybe related to #5097

    Reacted by Vincent Potuček
  8. oowekyala
    changed the title [-]Rule:UnusedPrivateMethod Priority:3 Avoid unused private methods such as 'addAllImpl[/-] [+][java] UnusedPrivateMethod FP with raw type for generic method[/+] on Sep 1, 2025
  9. oowekyala
    added this to the 7.20.0 milestone on Dec 1, 2025
  10. oowekyala
    added 2 commits that reference this issue on Dec 1, 2025

    Fix pmd#6028 - specificity bug

    This issue will close once commit 5f318ea is merged into the 'main' branch.
    5f318ea

    Fix pmd#6028 - specificity bug

    This issue will close once commit 406043b is merged into the 'main' branch.
    406043b
  11. adangel
    changed the title [-][java] UnusedPrivateMethod FP with raw type for generic method[/-] [+][java] UnusedPrivateMethod: False positive with raw type for generic method[/+] on Dec 19, 2025
  12. adangel
    closed this as completedin 406043bon Dec 19, 2025
  13. adangel
    added 2 commits that reference this issue on Dec 19, 2025

    [doc] Update release notes (#6028, #6294)

    36d255b

    [java] Fix #6028: UnusedPrivateMethod FP (#6294)

    e9579d7
  14. wener-tiobe
    added a commit that references this issue on Feb 10, 2026

    RM-37163: CPD 7.21.0 upgrade (#8)

    6a1959a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

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

    Type

    No type

    Projects

    No projects

      Milestone

      • 7.20.0

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.