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.
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