Skip to content

[java] ArrayIsStoredDirectly false negative when parenthesized #3933

@Zustin

Description

@Zustin

Affects PMD Version:
6.42.0

Rule: ArrayIsStoredDirectly

Description:
Hi, I found a false negative about the rule ArrayIsStoredDirectly. PMD should have reported a warning in line 3 because the array is stored directly. Actually, I think this false negative is caused by a "complex" expression (x). Thanks for your consideration.

Code Sample demonstrating the issue:

String [] arr;
void foo (String[] x) {
    arr = (x);  // should report a warning here
}

Expected outcome:

PMD should report a violation at line 3, but doesn't. This is a false-negative.

Running PMD through: [Maven]

Metadata

Metadata

Assignees

No one assigned

    Labels

    a:false-negativePMD doesn't flag a problematic piece of code

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions