My point was more that if you want an exception and not an error, you can add a default than discussing the merit of implicit vs explicit throwable.
The compiler should emit a code that throw an error for unknown enum constant. if the compiler emit a code that throw an exception, people will also be able to catch it, adding another way to react to a missing enum constant. regards, Rémi ----- Mail original ----- > De: "Brian Goetz" <[email protected]> > À: "Remi Forax" <[email protected]> > Cc: "Gavin Bierman" <[email protected]>, "amber-spec-experts" > <[email protected]> > Envoyé: Mercredi 28 Mars 2018 20:55:04 > Objet: Re: Expression switch exception naming >> 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.
