Menu

#1170 false positive with switch in loop

PMD-5.1.1
closed
None
PMD
3-Major
Bug
2014-04-27
2014-03-06
No

When there is a switch nested in a loop; i.e.

for (int i=0; i<str.length(); i++)
switch(str.charAt(i)) {
case 'a':
do_a();
break;
case 'b':
do_b();
break;
case 'c':
do_c();
break;
}

PMD issues a high priority AvoidBranchingStatementAsLastInLoop warning for each case statement, so the above switch would count as 3 last branching statements.

Discussion

  • Andreas Dangel

    Andreas Dangel - 2014-03-29

    This will be fixed with the next release.

     
  • Andreas Dangel

    Andreas Dangel - 2014-03-29
    • status: open --> closed
    • assigned_to: Andreas Dangel
    • Milestone: New Tickets --> PMD-Next
     

Log in to post a comment.