oh wow, for the first time in my life (that I can ...
# random
g
oh wow, for the first time in my life (that I can recall) Java's "Unreachable statement" actually caught a mistake. I had written
Copy code
public 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
...
f
I mean, the warnings idea gives for kotlin work too
p
what's wrong with the compiler checking for unreachable statement? it was never wrong in my case.. yes, for debugging i sometimes have to use
if(true)
to avoid it, but i wouldnt never need something like that in production code