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] CommentDefaultAccessModifier should consider lombok's @Value #4201

Closed
LynnBroe opened this issue Nov 9, 2022 · 0 comments · Fixed by #4202
Closed

[java] CommentDefaultAccessModifier should consider lombok's @Value #4201

LynnBroe opened this issue Nov 9, 2022 · 0 comments · Fixed by #4202
Labels
a:false-positive PMD flags a piece of code that is not problematic
Milestone

Comments

@LynnBroe
Copy link
Contributor

LynnBroe commented Nov 9, 2022

Affects PMD Version:6.51.0

Rule: CommentDefaultAccessModifier

Please provide the rule name and a link to the rule documentation:
https://pmd.github.io/latest/pmd_rules_java_codestyle.html#commentdefaultaccessmodifier

Description:
In the following code example, annotation @Value can add modifiers to the field fo$o, contradicted with default access modifier, so that no need to add a comment before its declaration, and this is a false positive.

Code Sample demonstrating the issue:

import lombok.Value;
@Value
public class Test {
    int fo$o;
}

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 Nov 9, 2022
LynnBroe added a commit to LynnBroe/pmd that referenced this issue Nov 9, 2022
LynnBroe added a commit to LynnBroe/pmd that referenced this issue Nov 10, 2022
LynnBroe added a commit to LynnBroe/pmd that referenced this issue Nov 10, 2022
@adangel adangel added this to the 6.52.0 milestone Nov 11, 2022
adangel added a commit that referenced this issue Nov 11, 2022
[java] Fix #4200 and #4201: ClassWithOnlyPrivateConstructorsShouldBeFinal, CommentDefaultAccessModifier: Exclude lombok @value annotation #4202
adangel added a commit to adangel/pmd that referenced this issue Oct 31, 2024
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
2 participants