Menu

#1287 UnusedPrivateMethod returns false positives for Superclass

PMD-5.2.2
not-reproducible
None
PMD
3-Major
Bug
5.2.1
2014-12-03
2014-11-25
No

I tried to update from PMD 5.1.1 to 5.2.1 but I have encountered a number of UnusedPrivateMethod false positives.

This is a simple example to demonstrate one issue

public class SuperClassFalsePositive {

    public void myPublicMethod() {
        throw convertToUnchecked(new MyException("Something Bad Happened"));
    }

    private IllegalArgumentException convertToUnchecked(Exception e) {
        return new IllegalArgumentException(e);
    }

    private static class MyException extends Exception {
        public MyException(String message) {
            super(message);
        }
    }
}

With PMD 5.2.1 I get

PMD Failure: SuperClassFalsePositive:11 Rule:UnusedPrivateMethod Priority:3 Avoid unused private methods such as 'convertToUnchecked(Exception)'..

With PMD 5.1.1 no issues reported.

Discussion

  • Andreas Dangel

    Andreas Dangel - 2014-11-26

    Not reproducible with 5.2.2(-SNAPSHOT) anymore - with and without auxclasspath.

    Probably fixed already with [#1281], [#1278] or [#1276].

     

    Related

    Issues: #1276
    Issues: #1278
    Issues: #1281

  • Andreas Dangel

    Andreas Dangel - 2014-11-26
    • status: open --> not-reproducible
    • assigned_to: Andreas Dangel
    • Milestone: New Tickets --> PMD-Next
     
  • Andreas Dangel

    Andreas Dangel - 2014-11-26
    • summary: #1286 UnusedPrivateMethod returns false positives for Superclass --> UnusedPrivateMethod returns false positives for Superclass
     

Log in to post a comment.

MongoDB Logo MongoDB