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] RedundantFieldInitializer: false positive with lombok's @Value #4458

Closed
LynnBroe opened this issue Apr 6, 2023 · 0 comments · Fixed by #4541
Closed

[java] RedundantFieldInitializer: false positive with lombok's @Value #4458

LynnBroe opened this issue Apr 6, 2023 · 0 comments · Fixed by #4541
Labels
a:false-positive PMD flags a piece of code that is not problematic
Milestone

Comments

@LynnBroe
Copy link
Contributor

LynnBroe commented Apr 6, 2023

Affects PMD Version:7.0.0-rc1

Rule: RedundantFieldInitializer

Please provide the rule name and a link to the rule documentation:
https://docs.pmd-code.org/latest/pmd_rules_java_performance.html#redundantfieldinitializer

Description:
The @Value annotation can add a final modifier to the field bar, so PMD should not report a warning at line 4.

Code Sample demonstrating the issue:

import lombok.Value;
@Value
public class Test {
    String bar = null;   // report a warning
}

Expected outcome:
PMD reports a violation at line 4, but that's wrong. That's a false positive.

Running PMD through: CLI

@LynnBroe LynnBroe added the a:false-positive PMD flags a piece of code that is not problematic label Apr 6, 2023
@LynnBroe LynnBroe changed the title false-positive about RedundantFieldInitializer and @Value [java]A false positive about RedundantFieldInitializer and @Value Apr 24, 2023
@adangel adangel changed the title [java]A false positive about RedundantFieldInitializer and @Value [java] RedundantFieldInitializer: false positive with lombok's @Value May 28, 2023
@adangel adangel added this to the 7.0.0 milestone May 28, 2023
adangel added a commit to adangel/pmd that referenced this issue May 28, 2023
adangel added a commit to adangel/pmd that referenced this issue May 28, 2023
[java] Fix pmd#4458: A false positive about RedundantFieldInitializer and @value pmd#4541
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

Successfully merging a pull request may close this issue.

2 participants