Synopsis: | A high ratio of statements to labels in a switch statement. Consider refactoring |
Language: | Java |
Severity Level: | 3 |
Category: | Design |
Description: |
A high ratio of statements to labels in a switch statement implies that the switch
statement is doing too much work. Consider moving the statements into new
methods, or creating subclasses based on the switch variable.public class Foo { public void bar(int x) { switch (x) { case 1: { // lots of statements break; } case 2: { // lots of statements break; } } } } |