GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — [java] ArrayIsStoredDirectly false positive with field access · Issue #1185 · pmd/pmd

[java] ArrayIsStoredDirectly false positive with field access #1185

New issue
Copy link
New issue
Copy link
Closed
#3930
Closed
[java] ArrayIsStoredDirectly false positive with field access#1185
#3930
Copy link
Labels
a:false-positivePMD flags a piece of code that is not problematic
Milestone
6.45.0

Description

@anicoara
anicoara
opened on Jun 11, 2018
Issue body actions

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]

Activity

  1. jsotuyod
    added
    a:false-positivePMD flags a piece of code that is not problematic
    on Jun 11, 2018
  2. adangel
    changed the title [-][java] ArrayIsStoredDirectly false positive[/-] [+][java] ArrayIsStoredDirectly false positive with field access[/+] on Apr 21, 2022
  3. adangel
    added this to the 6.45.0 milestone on Apr 21, 2022
  4. adangel
    added a commit that references this issue on Apr 21, 2022

    [java] ArrayIsStoredDirectly - fix field access with this

    This issue will close once commit 0d8373d is merged into the 'main' branch.
    0d8373d
  5. adangel
    closed this as completedin #3930on Apr 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    a:false-positivePMD flags a piece of code that is not problematic

    Type

    No type

    Projects

    No projects

      Milestone

      • 6.45.0

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.