2 questions about enums and the closed/withdrawn JEP 301

David Alayachew davidalayachew at gmail.com
Tue Mar 28 23:45:48 UTC 2023


Hello Amber Dev Team,

I was reading about JEP 301 and it's unfortunate withdrawal [1]. I also
took a look at the linked bugs.openjdk.org link [2]. There, Maurizio
Cimadamore linked to some discussions on the spec experts group of this
team, explaining why they decided to withdraw efforts on this JEP for the
time being.

Looking at 2 of the linked mailing list threads [3] [4] (and their
subsequent links), I tried my best to understand what exactly was being
explained, but failed to make sense of it. Here is the best that I could
make of it.

It seems like the original attempt failed because trying to put generics on
Enums immediately caused issues with some of thetools that use enums -
specifically, EnumSet and EnumMap. It seems to have something to do with
raw types not playing well with these specialized collections. Maurizio
explained the why of this, but my brain struggled to understand a lot of
the terminology. I tried googling, but ended up with a lot more concepts
that I struggled to understand. Repeat for a few hours before I got tired
out.

Key phrases that I struggled to understand from the original discussion in
[3] were f-bound and well formed types. Googling the definitions to these
terms felt like trying to learn integrals without knowing of derivatives or
limits.

Moving on the next discussion in [4], it seems like the issue with raw
types had been resolved by picking and choosing where we wanted to apply
that logic, implying that that could be controlled by the JVM or something.
Again, struggled to understand what was being said, but what I could pick
up on was that they had found a solution, and just wanted to know if the
cost of it/the effort needed to implement it was worth the benefit.

All of this leads me to 2 questions.

1. Could someone help me understand some of the more confusing terminology
so that I can understand what is being said in those discussions?

2. (And perhaps this is answered already once I understand 1) What was the
reason that enums weren't designed yo be generic in the first place? Did
the designers avoid it because they felt it would be a bad fit?

Thank you all for your time and patience!
David Alayachew

[1] = https://openjdk.org/jeps/301
[2] = https://bugs.openjdk.org/browse/JDK-8170351
[3] =
https://mail.openjdk.org/pipermail/amber-spec-experts/2017-May/000041.html
[4] =
https://mail.openjdk.org/pipermail/amber-spec-experts/2018-December/000876.html
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/amber-dev/attachments/20230328/b5c3edce/attachment.htm>


More information about the amber-dev mailing list