A RetroSearch Logo

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

Search Query:

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

[java] ArrayIsStoredDirectly false positive with private constructor/methods · Issue #2622 · pmd/pmd · GitHub

Affects PMD Version:
6.21.0.
Rule:
ArrayIsStoredDirectly

Description:
The rule should not trigger if the constructor/method under analysis is private.
Private constructors/methods do not get "user supplied" arrays.

Code Sample demonstrating the issue:

public class AISD {
    private final byte[] buf;
    private AISD(final byte[] buf) {
        this.buf = buf;  // this is not a violation!!
    }
    public AISD of(final byte[] buf) {
        return new AISD(buf.clone());
    }
}

Expected outcome:
PMD reports a violation, where there is none.
PMD should check the visibility of the constructor and skip the check.

Running PMD through: [CLI | Ant | Maven | Gradle | Designer | Other]
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