forked from phoedos/pmd
[java] UnusedPrivateMethod: Add test case for #3209
This commit is contained in:
@ -1744,4 +1744,26 @@ public class OuterClass {
|
|||||||
}
|
}
|
||||||
]]></code>
|
]]></code>
|
||||||
</test-code>
|
</test-code>
|
||||||
|
|
||||||
|
<test-code>
|
||||||
|
<description>[java] UnusedPrivateMethod false positive with static method and cast expression #3209</description>
|
||||||
|
<expected-problems>0</expected-problems>
|
||||||
|
<code><![CDATA[
|
||||||
|
public class UnusedAssignmentRule {
|
||||||
|
private static class ReachingDefsVisitor {
|
||||||
|
private static String getVarIfUnaryAssignment(String node) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public static class AssignmentEntry {
|
||||||
|
final String var;
|
||||||
|
final Object rhs;
|
||||||
|
public boolean isUnaryReassign() {
|
||||||
|
return rhs instanceof String
|
||||||
|
&& var.equals(ReachingDefsVisitor.getVarIfUnaryAssignment((String) rhs));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]]></code>
|
||||||
|
</test-code>
|
||||||
</test-data>
|
</test-data>
|
||||||
|
Reference in New Issue
Block a user