enhanced enums - back from the dead?
maurizio.cimadamore at oracle.com
Tue Dec 11 10:55:12 UTC 2018
On 10/12/2018 23:58, Brian Goetz wrote:
>> If we restrict this only to enums, of course this would be a non-issue; as you say, enums are non-generic right now, so we have a clean slate (assuming we're ok with the asymmetry).
> There’s an even more conservative option: restrict this only to the type variable of Enum<T extends Enum<T>>, not just to the type variables of all supertypes of an enum. Then, the asymmetry is undetectable, in that it is illegal for a non-enum class to extend Enum, right?
Yes, that would be the most conservative. If we took that path, I think
a more direct way to describe/specify it, is to say that a raw enum
reference (e.g. Foo) has a special direct supertype Enum<Foo> and leave
all other rules untouched.
More information about the amber-spec-experts