Expression switch exception naming

Doug Lea dl at cs.oswego.edu
Sun Apr 1 11:59:07 UTC 2018


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" <dl at cs.oswego.edu>
>> À: "Brian Goetz" <brian.goetz at oracle.com>
>> Cc: "amber-spec-experts" <amber-spec-experts at 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
>




More information about the amber-spec-observers mailing list