Affects PMD Version:LATEST
Rule:UnusedPrivateField
Please provide the rule name and a link to the rule documentation:
https://pmd.github.io/latest/pmd_rules_java_bestpractices.html#unusedprivatefield
Description:
Hi, I found a false positive about the rule UnusedPrivateField, please read the following code example. @tostring is from lombok library Link, and it can generate a toString method to use the private field. Its similar annotations in lombok have been considered. Hence, I think we should consider this annotation.
I think we can add one more line lombok.ToString.Include in method defaultSuppressionAnnotations of UnusedPrivateFieldRule 😄
Code Sample demonstrating the issue:
@ToString
public class C {
@ToString.Include
private int a; // Should not report a warning in this line
}
Expected outcome:
PMD should not report a violation at line 4, but doesn't. This is a false-positive.
Running PMD through: [Maven]
Affects PMD Version:LATEST
Rule:UnusedPrivateField
Please provide the rule name and a link to the rule documentation:
https://pmd.github.io/latest/pmd_rules_java_bestpractices.html#unusedprivatefield
Description:
Hi, I found a false positive about the rule UnusedPrivateField, please read the following code example. @tostring is from lombok library Link, and it can generate a
toStringmethod to use the private field. Its similar annotations in lombok have been considered. Hence, I think we should consider this annotation.I think we can add one more line
lombok.ToString.Includein methoddefaultSuppressionAnnotationsof UnusedPrivateFieldRule 😄Code Sample demonstrating the issue:
Expected outcome:
PMD should not report a violation at line 4, but doesn't. This is a false-positive.
Running PMD through: [Maven]