groostav
10/18/2019, 8:31 PMpublic Returnables doStuff(){
Returnables returnables;
switch(x){
case Instance1: returnables = makeReturnables()
default: throw new IllegalStateException();
}
return returnables; //error: unreachable.
Of course, I forgot to add a break
statement, which is a nasty language feature onto itself.
still! I've always been annoyed with java for compilation errors on "Unreachable code", and have on more than one occasion written if(1==1)
just to get around it! I'm impressed it caught me here. Well done java.
now to ctrl
+ alt
+ k
...Fudge
10/18/2019, 9:15 PMpoohbar
10/20/2019, 6:15 PMif(true)
to avoid it, but i wouldnt never need something like that in production code