Menu

#1269 UnusedPrivateMethod returns false positives. It doesn't appear to matter if the method call is nested several times or not

PMD-5.2.2
not-reproducible
PMD
2-Critical
Bug
5.1.3
2014-12-03
2014-10-04
Thomas Wolf
No

I'm opening a new bug as per developers instructions for bug 1228 - which is for the same thing. After upgrading to the easyPMD 5.0 plugin for netbeans, I started seeing a couple hundred UnusedPrivateMethod flags by PMD (I think the plugin comes with v5.1.3) - all of which are false. This is the same code base in which an earlier version of PMD did not output any UnusedPrivateMethod warnings.

At first I thought that perhaps it was a caching issue with easyPMD, but when my colleague - who uses Eclipse rather than Netbeans - upgraded his plugin to PMD 5.1.3, he too saw all these warnings.

The attached file is an example. PMD identifies the method "findByActionId2" as unused. The method is define don line 107. But if you look just a few lines above (line 105) and a few lines below (line 121), you can see that the method is definitely used. In the same file, PMD identifies private static method "getActionId()" as unused. But, again, the method is used on lines 401 and 423.

Unlike the other open bugs I've seen about UnusedPrivateMethod, my case does not involve anything fancy - i.e. no generics, etc.

1 Attachments

Discussion

  • Andreas Dangel

    Andreas Dangel - 2014-11-26

    I could reproduce it with 5.1.2, but since then, this issue seems to be already fixed (e.g. 5.1.3, 5.2.0, 5.2.1 don't show UnusedPrivateMethod violations).

     
  • Andreas Dangel

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

Log in to post a comment.

MongoDB Logo MongoDB