Menu

#1251 UnusedPrivateMethod false positives for boxing & unboxing arguments

PMD-5.1.3
closed
None
PMD
3-Major
Bug
5.1.2
2014-09-12
2014-08-30
Ross
No

If a private method is called with an unboxing Object argument, or a boxing primitive argument, then a false positive is generated for UnusedPrivateMethod.

I know that other people have reported false positives for UnusedPrivateMethod. I couldn't find an existing ticket for this issue, however, so I figured I submit it...

public class UnusedPrivateMethodFalsePositives {

    // UnusedPrivateMethod false positive
    private void prvUnboxing(final int i)     {}
    public  void pubUnboxing(final Integer i) {prvUnboxing(i);}

    // UnusedPrivateMethod false positive
    private void prvBoxing(final Integer i) {}
    public  void pubBoxing(final int i)     {prvBoxing(i);}

    // Correctly does not generate a warning
    private void prvPrimitive(final int i) {}
    public  void pubPrimitive(final int i) {prvPrimitive(i);}

    // Correctly does not generate a warning
    private void prvObject(final Integer i) {}
    public  void pubObject(final Integer i) {prvObject(i);}
}

Discussion

  • Andreas Dangel

    Andreas Dangel - 2014-08-30

    Thanks - it has been covered by [#1228] and it will be fixed with PMD 5.1.3.

     

    Related

    Issues: #1228

  • Andreas Dangel

    Andreas Dangel - 2014-08-30
    • status: open --> closed
    • assigned_to: Andreas Dangel
    • Milestone: New Tickets --> PMD-next
     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.