PMD 5.2.1 reports a method as unused when one of the arguments of type String is called using the result of a method in a parent class.
Example
public class SomeParent {
public String getName() { ... }
}
public class SomeChild extends SomeParent {
// do not override getName
}
public class SomeTest {
public someMethod(SomeChild child) {
doSomething(child.getName());
}
// this method is flagged as unused
// because it is called using "child.getName()"
// the workaround is to cast the call to String
private void doSomething(String name) {
// do some stuff
}
}
I can't reproduce this either.
Please checkout the attached zipfile for the test case I used and let me know, if this is really your example case.
Thanks,
Andreas
Hi, could you please test, whether this is still an issue with the version 5.2.2? Thanks!