UnusedPrivateMethod returns false positives for Superclass
A source code analyzer
Brought to you by:
adangel,
juansotuyo
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.
Not reproducible with 5.2.2(-SNAPSHOT) anymore - with and without auxclasspath.
Probably fixed already with [#1281], [#1278] or [#1276].
Related
Issues:
#1276Issues:
#1278Issues:
#1281