switch
statements or expressions in which the default
case
comes before another case.
This construct is unnecessarily confusing.
There is a quick-fix that moves the default
case to the last position.
The fix is available only when a given branch has break
/yield
at the end.
Example:
switch (n) {
default:
System.out.println();
break;
case 1:
break;
}
After the quick-fix is applied:
switch (n) {
case 1:
break;
default:
System.out.println();
break;
}