private final without setter is flagged
A source code analyzer
Brought to you by:
adangel,
juansotuyo
If a field is declared private final, the BeanMembersShouldSerialize
rule fails if there is only a getter method. Adding a setter resolves
the problem, but of course the setter cannot set anything.
It seems the rule should not require a setter. Right?
I'm running to the same problem. This comes for all POJ Data Holder classes, that have values assigned at construction and just read.
I am still witnessing this issue, even with PMD 5.0.5. Any chance that this can be resolved?
I think the fix is really simple...
In pmd/src/main/java/net/sourceforge/pmd/lang/java/rule/javabeans/BeanMembersShouldSerializeRule.java, change:
to:
See also https://github.com/pmd/pmd/pull/22