On Sat, March 31, 2018 8:14 am, Remi Forax wrote: > An enum class is always sealed, there is a fixed number of constants > values, and there is also a fixed number of subtypes, > otherwise values() is not correctly implemented.
Right. My point was that allowing "final" might allow programmers to distinguish the cases under question, rather forcing a new arbitrary rule about switch and enum being in same module, or whatever. -Doug Is non-exhaustiveness an Error or not? > > Rémi > > ----- Mail original ----- >> De: "Doug Lea" <d...@cs.oswego.edu> >> Ã: "Brian Goetz" <brian.go...@oracle.com> >> Cc: "amber-spec-experts" <amber-spec-experts@openjdk.java.net> >> Envoyé: Samedi 31 Mars 2018 13:56:44 >> Objet: Re: Expression switch exception naming > >> On Fri, March 30, 2018 1:48 pm, Brian Goetz wrote: >> >>> >>> So an alternative here is to tweak the language so that the "conclude >>> exhaustiveness if all enum constants are present" behavior should be >>> reserved for the cases where the switch and the enum are in the same >>> module? >>> >> >> I might have missed discussion of this, but has anyone considered >> the alternative of finally allowing "final" on an enum class? In >> this case, several sets of simpler alternatives would be possible. >> >> -Doug >