Expression switch exception naming

Brian Goetz brian.goetz at oracle.com
Wed Mar 28 18:55:04 UTC 2018



> Using a runtime exception is like another less readable way to do exactly that.
>
>

It's both less and more readable.

Its less readable in that its implicit in the code, rather than 
explicit.  But its probably the case that the exception thrown 
implicitly will be more informative to the user than the hand-written 
one, which is usually:

     default: throw new AssertionError("can't get here");

Which is less readable for the poor fellow who had to debug it.




More information about the amber-spec-experts mailing list