[java] ForLoopCanBeForeach reports on loop for (int i = 0; i < list.size(); i += 2)
#4569
Labels
a:false-positive
PMD flags a piece of code that is not problematic
Milestone
Affects PMD Version: 7.0.0-rc2 (Note: does not affect 6.55.0)
Rule: ForLoopCanBeForeach
https://docs.pmd-code.org/pmd-doc-7.0.0-rc1/pmd_rules_java_bestpractices.html#forloopcanbeforeach
Description:
I guess with the update of the ast and type resolution, the code broke? (github does not show any recent changes to the check and there is no test case present for
+=
increments)Code Sample demonstrating the issue:
Expected outcome:
PMD reports a violation for all three loops. It should only report the one in the middle.
For PMD 6.55.0 it does not report any of the loops.
Running PMD through: Other
The text was updated successfully, but these errors were encountered: