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);}
}
Thanks - it has been covered by [#1228] and it will be fixed with PMD 5.1.3.
Related
Issues:
#1228