Your use of if(0) is rather better than the tawdry use I sometimes make of the Java equivalent, if(false) - the Java compiler complains of unreachable code, and sometimes when you're working on something, it's nice to suppress that with an if(false) return;. Of course, Java is boring and won't let you jump into blocks with a case: like that...
I've seen at least one C compiler get confused by jumps into the middle of an if(0) clause, because it had dead-code-eliminated it before noticing the case label. (PuTTY used to contain some code which did that. The compiler developer sent me an embarrassed email thanking me for exposing the compiler bug, which was now fixed.)
I didn't know it was actually illegal in Java, though! Or do you just mean that Java doesn't let you put case statements in sub-blocks in general rather than that it specifically disallows them in otherwise unreachable ones?
The general case: it doesn't matter whether the code is reachable or not, you can't put case statements in sub-blocks. Not even sub-blocks that are just sub-blocks on their own (i.e. no if or for or while or whatever in front of them, they just start with {).
Your use of if(0) is rather better than the tawdry use I sometimes make of the Java equivalent, if(false) - the Java compiler complains of unreachable code, and sometimes when you're working on something, it's nice to suppress that with an if(false) return;. Of course, Java is boring and won't let you jump into blocks with a case: like that...
I didn't know it was actually illegal in Java, though! Or do you just mean that Java doesn't let you put case statements in sub-blocks in general rather than that it specifically disallows them in otherwise unreachable ones?