<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body>
    <div class="markdown-here-wrapper" data-md-url="" style="" markdown-here-wrapper-content-modified="true">
      <p style="margin: 0px 0px 1.2em !important;">Hi David,<br>
        sadly I don’t know the answer to your question as I wasn’t
        around when enums were added to the language ;-)</p>
      <p style="margin: 0px 0px 1.2em !important;">I agree with all
        Brian said. I’d also add that the failure modes we discovered
        when we worked on generic enums are rather obscure, as they are
        a result of <em>three</em> factors: (i) you need to have some
        class Foo that is transitioning from being non-generic to being
        generic and (ii) you have to have some existing utterances of
        Foo nested inside some other parameterized type (e.g. <code style="font-size: 0.85em; font-family: Consolas, Inconsolata, Courier, monospace;margin: 0px 0.15em; padding: 0px 0.3em; white-space: pre-wrap; border: 1px solid rgb(234, 234, 234); background-color: rgb(248, 248, 248); border-radius: 3px; display: inline;">Box<Foo></code><foo>)
          and (iii) the declaration of that second generic class has to
          be sufficiently strict (e.g. <code style="font-size: 0.85em; font-family: Consolas, Inconsolata, Courier, monospace;margin: 0px 0.15em; padding: 0px 0.3em; white-space: pre-wrap; border: 1px solid rgb(234, 234, 234); background-color: rgb(248, 248, 248); border-radius: 3px; display: inline;">Box<X extends Foo<X>></code>).
          If <em>all</em> these conditions are met, then you end up
          with cases where utterances of <code style="font-size: 0.85em; font-family: Consolas, Inconsolata, Courier, monospace;margin: 0px 0.15em; padding: 0px 0.3em; white-space: pre-wrap; border: 1px solid rgb(234, 234, 234); background-color: rgb(248, 248, 248); border-radius: 3px; display: inline;">Box<Foo></code><foo>
            were valid before generification of Foo, but invalid
            afterwards. Something like this was (and still is!) pretty
            hard to spot.</foo></foo></p>
      <p style="margin: 0px 0px 1.2em !important;">One might argue
        (given what we know now) that it would have been perhaps better
        not to make the Enum class itself generic. But the static type
        checking you get on stuff like <code style="font-size: 0.85em; font-family: Consolas, Inconsolata, Courier, monospace;margin: 0px 0.15em; padding: 0px 0.3em; white-space: pre-wrap; border: 1px solid rgb(234, 234, 234); background-color: rgb(248, 248, 248); border-radius: 3px; display: inline;">EnumSet.noneOf(Foo.class)</code>
        is hard to pass up: if <code style="font-size: 0.85em; font-family: Consolas, Inconsolata, Courier, monospace;margin: 0px 0.15em; padding: 0px 0.3em; white-space: pre-wrap; border: 1px solid rgb(234, 234, 234); background-color: rgb(248, 248, 248); border-radius: 3px; display: inline;">Enum</code>
        wasn’t a generic class, then there’d be no way to tie the type
        of the class literal to the type of the returned EnumSet. So I
        think the Enum generic declaration we ended up with is the
        result of a forced move (type-system wise).</p>
      <p style="margin: 0px 0px 1.2em !important;">Maurizio<br>
      </p>
      <p style="margin: 0px 0px 1.2em !important;">On 29/03/2023 19:43,
        David Alayachew wrote:</p>
      <p style="margin: 0px 0px 1.2em !important;"></p>
      <div class="markdown-here-exclude">
        <p></p>
        <blockquote type="cite" cite="mid:CAA9v-_NRPzJRrAb=Ufx=hLUKqRi7SKaotAMEz1bChOHDb63HFA@mail.gmail.com">
          
          <div dir="auto">
            <div dir="auto">Hello Maurizio,</div>
            <div dir="auto"><br>
            </div>
            <div dir="auto">I hope you don't mind me asking, but no one
              else has answered my 2nd question. And since you were the
              one who wrote up most of these links that I am
              referencing, it's a decent shot to see if you know the
              answer lol.</div>
            <div dir="auto"><br>
            </div>
            <div dir="auto">Why were enums never given generics in the
              first place? I know they came out in the same release, so
              theoretically, that was the best time possible to bake
              this feature in and ensure it played well from the
              beginning. Why didn't they?</div>
            <div dir="auto"><br>
            </div>
            <div dir="auto">Thank you for your help and patience!</div>
            <div dir="auto">David Alayachew</div>
          </div>
        </blockquote>
        <p></p>
      </div>
      <p style="margin: 0px 0px 1.2em !important;"></p>
      <div title="MDH:PHA+SGkgRGF2aWQsPGJyPnNhZGx5IEkgZG9uJ3Qga25vdyB0aGUgYW5zd2VyIHRvIHlvdXIgcXVlc3Rpb24gYXMgSSB3YXNuJ3QgYXJvdW5kIHdoZW4gZW51bXMgd2VyZSBhZGRlZCB0byB0aGUgbGFu
Z3VhZ2UgOy0pPC9wPjxwP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