Skip to content

Commit

Permalink
Merge branch 'pr-549'
Browse files Browse the repository at this point in the history
  • Loading branch information
jsotuyod committed Aug 9, 2017
2 parents 585a555 + 79ff3a4 commit 69fc7c8
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ public Object jjtAccept(JavaParserVisitor visitor, Object data) {
}

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() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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>
10 changes: 10 additions & 0 deletions src/site/markdown/overview/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ This is a major release.
* [Java Type Resolution](#Java_Type_Resolution)
* [Metrics Framework](#Metrics_Framework)
* [Configuration Error Reporting](#Configuration_Error_Reporting)
* [Java Symbol Table](#Java_Symbol_Table)
* [Modified Rules](#Modified_Rules)
* [Removed Rules](#Removed_Rules)
* [Fixed Issues](#Fixed_Issues)
Expand Down Expand Up @@ -79,6 +80,13 @@ and include them to such reports.
* The deprecated rule `UseSingleton` has been removed from the ruleset `java-design`. The rule has been renamed
long time ago to `UseUtilityClass`.


#### Java Symbol Table

* A [bug in symbol table](https://github.com/pmd/pmd/pull/549/commits/0958621ca884a8002012fc7738308c8dfc24b97c) prevented
the symbol table analysis to properly match primitive arrays types. The issue [affected the `java-unsedcode/UnusedPrivateMethod`](https://github.com/pmd/pmd/issues/521)
rule, but other rules may now produce improved results as consequence of this fix.

### Fixed Issues

* apex
Expand All @@ -95,6 +103,8 @@ and include them to such reports.
* [#408](https://github.com/pmd/pmd/issues/408): \[java] DFA not analyzing asserts
* java-sunsecure
* [#468](https://github.com/pmd/pmd/issues/468): \[java] ArrayIsStoredDirectly false positive
* java-unusedcode
* [#521](https://github.com/pmd/pmd/issues/521): \[java] UnusedPrivateMethod returns false positives with primitive data type in map argument
* java-unnecessarycode
* [#412](https://github.com/pmd/pmd/issues/412): \[java] java-unnecessarycode/UnnecessaryFinalModifier missing cases

Expand Down

0 comments on commit 69fc7c8

Please sign in to comment.