PB.PDS
Provide "default:" for each "switch" statement
Description
This rule flags any "switch" statement that does not have a "default" label.
Example
package PB;
public class PDS {
void method (int i) {
switch (i) {
case 1:
a = 10;
break;
case 2:
case 3:
a = 20;
return;
} // missing default label
}
}
Repair
Add a "default" statement.
|