Affects PMD Version:
6.44, 6.45, 6.46
Rule:
ImmutableField
Please provide the rule name and a link to the rule documentation:
https://pmd.github.io/pmd-6.46.0/pmd_rules_java_design.html#immutablefield
Description:
Fields only initialized in the declaration can be made final. PMD does not report such problem since 6.44.0.
Code Sample demonstrating the issue:
public class Foo {
private String variable = "hello";
public String getVariable() {
return variable;
}
}
Expected outcome:
PMD should report a violation at line 2, but doesn't. This is a false-negative.
Running PMD through: CLI, Maven
Some of my personal idea: many issues related to ImmutableField (#3874 #3981 #3998 #4004) have occurred since PMD 6.44.0. And the solution is to keep adding annotations to defaultSuppressionAnnotations
. Personally I don't think it a good idea...
In 6.44.0 PMD introduced some changes in the ImmutableFieldRule in #3855 , can we investigate it a little bit more?
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4