Fix #521
This commit is contained in:
@ -23,11 +23,11 @@ public class ASTType extends AbstractJavaTypeNode {
|
||||
}
|
||||
|
||||
public String getTypeImage() {
|
||||
ASTPrimitiveType prim = getFirstDescendantOfType(ASTPrimitiveType.class);
|
||||
if (prim != null) {
|
||||
return prim.getImage();
|
||||
ASTClassOrInterfaceType refType = getFirstDescendantOfType(ASTClassOrInterfaceType.class);
|
||||
if (refType != null) {
|
||||
return refType.getImage();
|
||||
}
|
||||
return getFirstDescendantOfType(ASTClassOrInterfaceType.class).getImage();
|
||||
return getFirstDescendantOfType(ASTPrimitiveType.class).getImage();
|
||||
}
|
||||
|
||||
public int getArrayDepth() {
|
||||
|
@ -1531,4 +1531,22 @@ public class Something {
|
||||
}
|
||||
]]></code>
|
||||
</test-code>
|
||||
|
||||
<test-code>
|
||||
<description>#521 UnusedPrivateMethod returns false positives with primitive data type in map argument</description>
|
||||
<expected-problems>0</expected-problems>
|
||||
<code><![CDATA[
|
||||
public class Foo {
|
||||
public Foo() {
|
||||
Map<String, double[]> map = new LinkedHashMap<>();
|
||||
addToMap(map);
|
||||
}
|
||||
|
||||
private void addToMap(Map<String, double[]> map) {
|
||||
map.put("foo", new double[]{0., 1.});
|
||||
}
|
||||
}
|
||||
]]></code>
|
||||
</test-code>
|
||||
|
||||
</test-data>
|
||||
|
Reference in New Issue
Block a user