A RetroSearch Logo

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

Search Query:

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

[java] ArrayIsStoredDirectly false positive with field access · Issue #1185 · pmd/pmd · GitHub

Affects PMD Version: 6.4.0

Rule: ArrayIsStoredDirectly

Description: False positive when passing field, that shares the same name as input parameter, to constructor of different object.

Code Sample demonstrating the issue:

class TestArrayIsStoredDirectly {
    private final boolean[] a;
    private final foo b;

    private TestArrayIsStoredDirectly(boolean[] a) {
        this.a = null;
        this.a = a.clone(); // no violation, it doesn't matter what the state of this.a is
        this.b = new TestArrayIsStoredDirectly(a); // no violation
        this.b = new TestArrayIsStoredDirectly(this.a); // false positive violation here
    }
}

Rule Property: allowPrivate=false

Running PMD through: [CLI | Maven]


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