GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — [java] ForLoopCanBeForeach: inconsistent detection between `i += 1` and `i = i + 1` update forms · Issue #6692 · pmd/pmd Closed Labels a:false-negativePMD doesn't flag a problematic piece of code Milestone DescriptionAffects PMD Version: 7.24.0 Rule: ForLoopCanBeForeach — https://docs.pmd-code.org/latest/pmd_rules_java_bestpractices.html#forloopcanbeforeach Description: The Code Sample demonstrating the issue: import java.util.List; public class Sample { public static void main(String[] args) { List<Integer> list = List.of(1, 2, 3, 4, 5, 6); // Case 1: Flagged correctly by ForLoopCanBeForeach for (int i = 0; i < list.size(); i += 1) { System.out.println(list.get(i)); } // Case 2: NOT flagged (False Negative) for (int i = 0; i < list.size(); i = i + 1) { System.out.println(list.get(i)); } } } Expected outcome: PMD should report a violation at line 13, but doesn't. This is a false-negative. Running PMD through: CLI Activity
MetadataMetadataAssigneesLabelsa:false-negativePMD doesn't flag a problematic piece of code TypeProjectsMilestoneRelationshipsDevelopmentIssue actions |
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |