Fix #521
This commit is contained in:
@ -23,11 +23,11 @@ public class ASTType extends AbstractJavaTypeNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String getTypeImage() {
|
public String getTypeImage() {
|
||||||
ASTPrimitiveType prim = getFirstDescendantOfType(ASTPrimitiveType.class);
|
ASTClassOrInterfaceType refType = getFirstDescendantOfType(ASTClassOrInterfaceType.class);
|
||||||
if (prim != null) {
|
if (refType != null) {
|
||||||
return prim.getImage();
|
return refType.getImage();
|
||||||
}
|
}
|
||||||
return getFirstDescendantOfType(ASTClassOrInterfaceType.class).getImage();
|
return getFirstDescendantOfType(ASTPrimitiveType.class).getImage();
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getArrayDepth() {
|
public int getArrayDepth() {
|
||||||
|
@ -1531,4 +1531,22 @@ public class Something {
|
|||||||
}
|
}
|
||||||
]]></code>
|
]]></code>
|
||||||
</test-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>
|
</test-data>
|
||||||
|
Reference in New Issue
Block a user