I have several switch statements which test an enum. All enum values must be handled in the switch statements by a case s
Probably a tool like FindBugs will mark such switches.
The hard answer would be to refactor:
Possibility 1: can go Object Oriented
If feasible, depends on the code in the cases.
Instead of
switch (language) {
case EO: ... break;
case IL: ... break;
}
create an abstract method:, say p
language.p();
or
switch (p.category()) {
case 1: // Less cases.
...
}
Possibility 2: higher level
When having many switches, in an enum like DocumentType, WORD, EXCEL, PDF, ... . Then create a WordDoc, ExcelDoc, PdfDoc extending a base class Doc. And again one can work object oriented.