Is there an annotation or another method to turn the non-exhaustive switch statement warning into an error? I want a certain method or class to produce an error if not all values have been handled in the switch properly.
Example:
public enum E {
A,
B
}
and somewhere else in the code there is a switch on that enum like so
switch (enumValue) {
case A: /* do something */ break;
}
Java will give you a warning that this switch does not handle all the enum values. I want to turn this warning into an error (permanently, regardless of individual IDE settings).
Please keep in mind that I cannot change the original enum
in this case, so I want the compiler to enforce it.