Affects PMD Version:
6.44.0 and 6.45.0
Rule:
ImmutableField
https://pmd.github.io/pmd-6.45.0/pmd_rules_java_design.html#immutablefield
Description:
Similar to the issue #3874, when annotating fields with Spring's @Value annotation, PMD (starting from 6.44.0) will report "the field could be made final. It is only initialized in the declaration or constructor." However, the fields need to be non-final in order for the reflection.
Code Sample demonstrating the issue:
@Configuration
public class SomeConfig {
@Value("${someConfigValue}")
private String someConfigField;
}
Expected outcome:
PMD reports a violation for someConfigField, but that's wrong. That's a false positive.
Running PMD through:
CLI and Maven
Affects PMD Version:
6.44.0 and 6.45.0
Rule:
ImmutableField
https://pmd.github.io/pmd-6.45.0/pmd_rules_java_design.html#immutablefield
Description:
Similar to the issue #3874, when annotating fields with Spring's
@Valueannotation, PMD (starting from 6.44.0) will report "the field could be made final. It is only initialized in the declaration or constructor." However, the fields need to be non-final in order for the reflection.Code Sample demonstrating the issue:
Expected outcome:
PMD reports a violation for
someConfigField, but that's wrong. That's a false positive.Running PMD through:
CLI and Maven