#1456 [java] UnusedFormalParameter: should ignore overriding methods

PMD-5.3.7
closed
java (55)
PMD
3-Major
Bug
5.4.1
UnusedFormalParameter
2016-06-25
2016-01-30
No

In the next code segment, if UnusedFormalParameter.checkAll is true:

abstract class Base{
  abstract public int badMethod(int arg1, String arg2);
}

class Imp1 extends Base {
  @Override
  public int badMethod(int arg1, String arg2) {
    return arg2.length();
  }
}

class Imp2 extends Base {
  @Override
  public int badMethod(int arg1, String arg2) {
    return arg2.length() + arg1;
  }
}

Imp1.badMethod() is overriding Base.badMethod(), so arg1 should not be considered "unused".

Discussion

  • Andreas Dangel

    Andreas Dangel - 2016-02-07
    • status: open --> closed
    • assigned_to: Andreas Dangel
    • Milestone: New Tickets --> PMD-5.3.7
    • Ruleset / Rule: --> UnusedFormalParameter
     
  • Anonymous - 2016-02-07

    Thanks!

     
  • Andreas Dangel

    Andreas Dangel - 2016-06-25
    • labels: --> java
    • summary: UnusedFormalParameter should ignore overriding methods --> [java] UnusedFormalParameter: should ignore overriding methods
     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks