This commit is contained in:
oowekyala
2017-08-09 16:40:05 +02:00
parent 585a555ba5
commit 0958621ca8
2 changed files with 22 additions and 4 deletions

View File

@ -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() {

View File

@ -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>