[java] SingularField false positive with read in while condition #3754
Labels
a:false-positive
PMD flags a piece of code that is not problematic
in:data-flow
Affects the data flow analysis code
Milestone
Affects PMD Version: 7.0.0-SNAPSHOT
Rule: SingularField
Description: This is a false positive detected by dogfood (#3657) on PMD 7. I thought it would have been fixed by #3671, but it is still there. I think, this is in the realm of dataflow. See the sample code below, there are various different cases.
Code Sample demonstrating the issue:
Expected outcome:
PMD reports a violation at lines 4 and 13, but that's wrong. That's a false positive.
The field is read at the beginning of the method "foo" and the current value is unknown. So this field cannot be converted to a local variable.
Running PMD through: Maven
The text was updated successfully, but these errors were encountered: