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: False negative when break inside switch statement · Issue #5877 · pmd/pmd Closed Labels a:false-negativePMD doesn't flag a problematic piece of code Milestone DescriptionAffects PMD Version: 7.15.0 Rule: AvoidArrayLoops Description: Code Sample demonstrating the issue: import java.util.Arrays; class ArrayLoopBugDemo { public int[] showBug(int[] source, int condition) { int[] destination = new int[source.length]; for (int i = 0; i < source.length; i++) { // should raise AvoidArrayLoops here destination[i] = source[i]; switch (condition) { case 0: System.out.println("This is an unreachable switch case."); break; } } return destination; } public static void main(String[] args) { ArrayLoopBugDemo demo = new ArrayLoopBugDemo(); int[] dest = demo.showBug(new int[]{1, 2, 3, 4, 5}, 1); } } Expected outcome: PMD should report a violation at line 7, 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. |