Example:
public class EnumSwitchTest {
private static enum PrimaryColor {RED, GREEN, BLUE};
public static void main(String[] args) {
PrimaryColor n = PrimaryColor.RED;
switch (n) {
case RED:
System.out.println("red");
break;
case GREEN:
System.out.println("green");
break;
}
}
}
Problem because:
What happens if one of the uncovered enums appears?
Severity: medium; possible bug
Fix: At a minimum throw a RuntimeException in a default block