Skip to content

[java] Make UnusedFormalParameter consider enum classes #3628

@Zustin

Description

@Zustin

Affects PMD Version:6.39.0

Rule:UnusedFormalParameter

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

Description:
Hi! I think PMD should report a warning at line 5 because there is a unused formal parameter arg, but it does not. Hence, I think this is a false negative. Thanks for your consideration. I am willing to help fix this issue.

Code Sample demonstrating the issue:

class Tester {
  enum EnumClass {
    FOO;
    EnumClass() {}
    private void func(int arg) {}  // should report a warning here
  }
}

Expected outcome: A warning

PMD should report a violation at line 5, but doesn't. This is a false-negative.

Running PMD through: [Maven]

Metadata

Metadata

Assignees

No one assigned

    Labels

    a:false-negativePMD doesn't flag a problematic piece of code

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions