2 questions about enums and the closed/withdrawn JEP 301

Archie Cobbs archie.cobbs at gmail.com
Wed Mar 29 22:55:59 UTC 2023


On Wed, Mar 29, 2023 at 4:07 PM Maurizio Cimadamore <
maurizio.cimadamore at oracle.com> wrote:

>
> Personally, I would still be happy to have generic enums even without any
> accomodation by EnumSet/EnumMap.
>
> I hear you - but I believe that EnumSet/Map with their methods are just a
> reminder of what would actually happen should we unleash generic enums in
> the large. There are many API enum-friendly points sedimented over the
> years which use the exact same patterns as EnumSet/Map - all these API
> points will not be usable when working with a generic enum. So, even if the
> JDK might come up with some solution for its own problematic classes (and
> that solution is not even 100% satisfying), there are classes outside our
> control that will just not work with the new enums. One rule we try to
> stick to when adding new features to the Java language, is that it should
> look like they have been there from the start. WIth generic enums that's
> sadly not the case, and worse, they create a split between API points that
> work with them and those which don't, which is ultimately bad for the
> ecosystem.
>
I see your point (thanks for explaining).

It is a conundrum.

-- 
Archie L. Cobbs
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/amber-dev/attachments/20230329/aef0ec2a/attachment.htm>


More information about the amber-dev mailing list