JEP 301: Enhanced Enums
forax at univ-mlv.fr
forax at univ-mlv.fr
Wed Dec 7 22:28:18 UTC 2016
> De: "Maurizio Cimadamore" <maurizio.cimadamore at oracle.com>
> À: "Remi Forax" <forax at univ-mlv.fr>, platform-jep-discuss at openjdk.java.net
> Envoyé: Mercredi 7 Décembre 2016 10:48:44
> Objet: Re: JEP 301: Enhanced Enums
> Thanks for the feedback. I personally run into the lack of sharp typing
> several times and seen other people stumbling on it too.
>
> Do you have some example in mind that will break - other than the ones
> listed in the JEP? In my mental model, the kind of surprises this
> introduces are very similar to anonymous inner class types - that is:
>
> new Object() { void m() { } }.m();
>
> this is legal code because the receiver expression doesn't have type
> Object - but has a sharper type (which can 'see' the additional member).
> This proposal is about doing the same with enums - which accidentally
> will sit well with adding generics (because in that case, the constants
> will have a richer generic type than their parent).
Abstract enum where introduces as a kind of strawman lambdas (see [1]),
and as Stephen said there were intentionally restricted to not be more than that.
>
> Maurizio
Rémi
[1] https://youtu.be/pi_I7oD_uGI?t=2041
>
>
> On 07/12/16 09:03, Remi Forax wrote:
>> Now, If this proposal is accepted, at least, instead of changing the spec to
>> introduce sharp types for all kind of enums, adding sharp type only for
>> generics enums,
> > it will break no code because generics enum currently do not compile.
More information about the platform-jep-discuss
mailing list