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] AvoidArrayLoops regression: from false negative to false positive with final variables · Issue #4183 · pmd/pmd Closed Labels a:false-positivePMD flags a piece of code that is not problematic Milestone DescriptionAffects PMD Version: 6.51.0 Rule: AvoidArrayLoops Description: Code Sample demonstrating the issue: public class Test { public static void sample() { final int[] a = new int[10]; final int[] b = new int[10]; for (int i=0; i<10; i++) { final int c = i; b[i] = a[i+c]; } } } Expected outcome: PMD reports a violation at line 5, but that's wrong. That's a false positive. Running PMD through: CLI True positive code samplespublic class Test { public static void sample() { final int[] a = new int[10]; final int[] b = new int[10]; final int c = 6; for (int i=0; i<10; i++) { b[i] = a[i+c]; } } } public class Test { public static void sample() { final int[] a = new int[10]; final int[] b = new int[10]; for (int i=0; i<10; i++) { final int c = 6; b[i] = a[i+c]; } } } True negative code samplespublic class Test { public static void sample() { final int[] a = new int[10]; final int[] b = new int[10]; for (int i=0; i<10; i++) { int c = i; b[i] = a[i+c]; } } } Activity
MetadataMetadataAssigneesLabelsa:false-positivePMD flags a piece of code that is not problematic 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. |