Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[java] A false positive about the rule RedundantFieldInitializer #4070

Closed
Zustin opened this issue Jul 28, 2022 · 0 comments
Closed

[java] A false positive about the rule RedundantFieldInitializer #4070

Zustin opened this issue Jul 28, 2022 · 0 comments
Assignees
Labels
a:false-positive PMD flags a piece of code that is not problematic
Milestone

Comments

@Zustin
Copy link

Zustin commented Jul 28, 2022

Affects PMD Version:6.47.0

Rule:RedundantFieldInitializer

Please provide the rule name and a link to the rule documentation:
https://pmd.github.io/pmd-6.47.0/pmd_rules_java_performance.html#redundantfieldinitializer

Description:
In the following code example, I found a FP. Line 3 is not a redundant initializer, but it reports a warning.

Code Sample demonstrating the issue:

public class FP {
    private static final int BASE = 1;
    char c = 0 + BASE;  // should not report a warning in this line
}

Expected outcome:

PMD reports a violation at line 3, but that's wrong. That's a false positive.

Running PMD through: [Maven]

@Zustin Zustin added the a:false-positive PMD flags a piece of code that is not problematic label Jul 28, 2022
@oowekyala oowekyala added this to the 7.0.0 milestone Apr 26, 2023
@oowekyala oowekyala changed the title A false positive about the rule RedundantFieldInitializer [java] A false positive about the rule RedundantFieldInitializer May 2, 2023
@oowekyala oowekyala self-assigned this May 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a:false-positive PMD flags a piece of code that is not problematic
Projects
None yet
Development

No branches or pull requests

2 participants