Expression switch exception naming
Brian Goetz
brian.goetz at oracle.com
Fri Apr 20 17:26:58 UTC 2018
I am totally unsurprised to see this observation. And, I also think
that if we did declare some of them sealed, on the basis of being unable
to imagine that more would be added, we'd be wrong as often as right,
other than the obvious extremes of Month and ElementType. Which puts us
in a bind.
That said, in light of the recent leap from UA1 to UA2, I am starting to
question the wisdom of assuming that an enum is sealed. In light of
morning, it feels more in the category of "picking winning idioms"
rather than composing behavior from first principles.
>> Right. I think there are two kinds of enums, call them sealed and unsealed,
> What I found in reviewing enums in the JDK is that it's pretty hard to find enums you can _guarantee_ will never grow. java.time.Month, sure. But what about Thread.State? StandardOpenOption? System.Logger.Level? Am I prepared to guarantee that we'll never have a reason to add another case?
>
> So some sort of declaration-site feature would, I fear, either get little use or be routinely ignored when changes must be made.
>
More information about the amber-spec-experts
mailing list