Fw: JEP 455: Non-enhanced switch statements
Brian Goetz
brian.goetz at oracle.com
Fri Oct 27 14:33:29 UTC 2023
> Sure - but this logic is only applied to switch expression featuring
> enums AFAIK - switch statements with enums are non-exhaustive (and I
> think that will have to stay that way).
Slight correction: switch statements on enum selectors *that don't use
patterns or guards or case null* are non-exhaustive. IOW, the current
carve-out for non-exhaustiveness is "if you don't use any of the new
switch features."
As to "will have to stay that way", I guess it depends on timeframe. I
can see a path of gradually increasing warnings ("totalize that switch
with a default clause, dude") turning to error in a decade or so?
More information about the amber-spec-experts
mailing list