A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/pmd/pmd/issues/521 below:

[java] UnusedPrivateMethod returns false positives with primitive data type in map argument · Issue #521 · pmd/pmd · GitHub

Rule Set:
UnusedPrivateMethod

Description:
A private method with a signature containing a map as argument, and with that map having a list of doubles as values using a primitive type, e.g. double[], PMD unexpectedly reports an unused private method.

Code Sample demonstrating the issue:

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.});
    }
}

Running PMD through: Gradle (Gradle 3.5, tried with default pmd plugin as well as toolVersion = '5.8.0')

PMD does not complain when using the boxed variant:

// This is ok!
private void addToMap(Map<String, Double[]> map) {
    // ...
}

Is this better/the preferred style anyway?

Seemingly related: https://sourceforge.net/p/pmd/bugs/1228/


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4