<!DOCTYPE html>
<!-- BaNnErBlUrFlE-BoDy-start -->
<!-- Preheader Text : BEGIN -->
<div style="display:none !important;display:none;visibility:hidden;mso-hide:all;font-size:1px;color:#ffffff;line-height:1px;max-height:0px;opacity:0;overflow:hidden;">
Hi, This reads like a bunch of AI generated silliness. How on earth would you coordinate a 4 step migration process between a client and library, unless you strongly control both. /Kasper /Kasper On Tue, 24 Feb 2026 at 14: 16, Clement Cherlin</div>
<!-- Preheader Text : END -->

<!-- Email Banner : BEGIN -->
<div style="display:none !important;display:none;visibility:hidden;mso-hide:all;font-size:1px;color:#ffffff;line-height:1px;max-height:0px;opacity:0;overflow:hidden;">ZjQcmQRYFpfptBannerStart</div>

<!--[if ((ie)|(mso))]>
  <table border="0" cellspacing="0" cellpadding="0" width="100%" style="padding: 0px 0px 10px 0px; direction: ltr" lang="en"><tr><td>
    <table border="0" cellspacing="0" cellpadding="0" style="padding: 0px 8px 6px 8px; width: 100%; border-radius:4px; border-top:4px solid #8193a0;background-color:#60beeb;"><tr><td valign="top">
      <table align="left" border="0" cellspacing="0" cellpadding="0" style="padding: 0px 8px 4px 8px; font-size: 12px; line-height: 16px">
        <tr><td style="color:#000000; font-family: 'Arial', sans-serif; font-weight:bold; font-size:14px; line-height: 20px; direction: ltr">
          This Message Is From an Untrusted Sender
        </td></tr>
        <tr><td style="color:#000000; font-weight:normal; font-family: 'Arial', sans-serif; font-size:12px; direction: ltr">
          You have not previously corresponded with this sender.
        </td></tr>

      </table>
      <![if ie]><br clear="all"><![endif]>
      <table align="right" border="0" cellspacing="0" cellpadding="0" style="padding: 0px 0px 4px 0px; font-size: 14px; line-height: 36px"><tr>
        <td style="direction: ltr">  <a target="_blank" href="https://us-phishalarm-ewt.proofpoint.com/EWT/v1/ACWV5N9M2RV99hQ!Op20OCUGuqhutZADfzlf-CqD5q7ieR_q_54zPUMaOQizOq0zzUq0q-l6_tgsOs_ZAlWeKebfC6ByAQK_Tc3LlQqtWibKw0BmqEkOvTT7vjgqigEMJxWLWnYpRWE02x4$" style="mso-padding-alt: 7px; padding: 7px; border-radius: 2px; border: 1px solid #666666; "><strong style="font-weight: normal; color: #000000; text-decoration: none; font-family: 'Arial', sans-serif; font-size: 14px;">  Report Suspicious  </strong></a>  ‌ </td>
      </tr></table>
    </td></tr></table>
  </td></tr></table>
<![endif]-->

<![if !((ie)|(mso))]>
  <div dir="ltr" lang="en" id="pfptBanner66xxmmb" style="all: revert !important; display:block !important; text-align: left !important; margin: 0 0 10px 0 !important; padding:7px 16px 8px 16px !important; border-radius: 4px !important; min-width: 200px !important; background-color: #60beeb !important; background-color: #60beeb; border-top: 4px solid #8193a0 !important; border-top: 4px solid #8193a0;">
    <div id="pfptBanner66xxmmb" style="all: unset !important; float:left !important; display:block !important; margin: 1px 0 1px 0 !important; max-width: 600px !important;">
      <div id="pfptBanner66xxmmb" style="all: unset !important; display:block !important; visibility: visible !important; background-color: #60beeb !important; color:#000000 !important; color:#000000; font-family: 'Arial', sans-serif !important; font-family: 'Arial', sans-serif; font-weight:bold !important; font-weight:bold; font-size:14px !important; line-height:1.29 !important; line-height:1.29">
        This Message Is From an Untrusted Sender
      </div>
      <div id="pfptBanner66xxmmb" style="all: unset !important; display:block !important; visibility: visible !important; background-color: #60beeb !important; color:#000000 !important; color:#000000; font-weight:normal; font-family: 'Arial', sans-serif !important; font-family: 'Arial', sans-serif; font-size:12px !important; line-height:1.5 !important; line-height:1.5; margin-top:2px !important;">
You have not previously corresponded with this sender.
      </div>

    </div>
    <div id="pfptBanner66xxmmb" style="all: unset !important; float: right !important; display: block !important; display: block; margin-left: 16px !important; margin-top: 1px !important; text-align: right !important; width: fit-content !important; font-size: 12px !important">
<a id="pfptBanner66xxmmb" href="https://us-phishalarm-ewt.proofpoint.com/EWT/v1/ACWV5N9M2RV99hQ!Op20OCUGuqhutZADfzlf-CqD5q7ieR_q_54zPUMaOQizOq0zzUq0q-l6_tgsOs_ZAlWeKebfC6ByAQK_Tc3LlQqtWibKw0BmqEkOvTT7vjgqigEMJxWLWnYpRWE02x4$"
    style="all: unset !important; display: inline-block !important; text-decoration: none">
    <div class="pfptPrimaryButton66xxmmb" style="display: inline-block !important; display: inline-block; visibility: visible !important; opacity: 1 !important; color: #000000 !important; color: #000000; font-family: 'Arial', sans-serif !important; font-family: 'Arial', sans-serif; font-size: 14px !important;  font-weight: normal !important; text-decoration: none !important; border-radius: 2px !important; margin-top: 3px !important; margin-bottom: 3px !important; margin-left: 16px !important; padding: 7.5px 16px !important; white-space: nowrap !important; width: fit-content !important;
        border: 1px solid #666666">
        Report Suspicious
    </div>
</a>
    </div>
    <div style="clear: both !important; display: block !important; visibility: hidden !important; line-height: 0 !important; font-size: 0.01px !important; height: 0px"> </div>
  </div>
<![endif]>

<div style="display:none !important;display:none;visibility:hidden;mso-hide:all;font-size:1px;color:#ffffff;line-height:1px;max-height:0px;opacity:0;overflow:hidden;">ZjQcmQRYFpfptBannerEnd</div>
<!-- Email Banner : END -->

<!-- BaNnErBlUrFlE-BoDy-end -->
<html>
<head><!-- BaNnErBlUrFlE-HeAdEr-start -->
<style>
  #pfptBanner66xxmmb { all: revert !important; display: block !important;
    visibility: visible !important; opacity: 1 !important;
    background-color: #60beeb !important;
    max-width: none !important; max-height: none !important }
  .pfptPrimaryButton66xxmmb:hover, .pfptPrimaryButton66xxmmb:focus {
    background-color: #77a8c4 !important; }
  .pfptPrimaryButton66xxmmb:active {
    background-color: #8193a0 !important; }
  html:root, html:root>body { all: revert !important; display: block !important;
    visibility: visible !important; opacity: 1 !important; }
</style>

<!-- BaNnErBlUrFlE-HeAdEr-end -->
</head><body><pre style="font-family: sans-serif; font-size: 100%; white-space: pre-wrap; word-wrap: break-word">Hi,

This reads like a bunch of AI generated silliness. How on earth would
you coordinate a 4 step migration process between a client and
library, unless you strongly control both.

/Kasper


/Kasper

On Tue, 24 Feb 2026 at 14:16, Clement Cherlin <ccherlin@gmail.com> wrote:
>
> On Mon, Feb 23, 2026 at 6: 26 AM Maurizio Cimadamore <maurizio. cimadamore@ oracle. com> wrote: Hi Clement On 22/02/2026 18: 21, Clement Cherlin wrote: > Greetings, > > I have been working on the problem of generic enums off and on
>
> On Mon, Feb 23, 2026 at 6:26 AM Maurizio Cimadamore <maurizio.cimadamore@oracle.com> wrote:
>>
>> Hi Clement
>>
>> On 22/02/2026 18:21, Clement Cherlin wrote:
>> > Greetings,
>> >
>> > I have been working on the problem of generic enums off and on for
>> > quite some time (see
>> > https://github.com/Mooninaut/cursed-generic-enum-java for a previous
>> > dead-end attempt).
>> >
>> > I think I have an actual solution this time, and it doesn't require
>> > any changes to Java's type system. It only requires a slight tweak to
>> > the "extends" clause of generic enums: Replace "extends
>> > Enum<SomeEnum<T>>" with "extends Enum SomeEnum<?>>".
>>
>> I'd need more time to think about the consequences of this. That said,
>> this has a good property, in that it only affects generic enum
>> declarations. Non-generic enum would stay exactly the same.
>>
>> > There is one slightly awkward issue. It's not possible to simply pass
>> > an enum class literal to EnumSet's static factory methods without a
>> > raw cast.
>> >
>> > EnumSet.allOf((Class<Option<?>>) (Class) Option.class);
>>
>> This makes me more worried -- because this is such a common idiom that
>> (I think) has to work like for any other enum.
>>
>> In the spirit of your earlier suggestion, a possible way out would be to
>> also redefine what Foo.class mean when Foo is a generic enum -- e.g. not
>> just Class<Foo> (class-of-raw) but Class<Foo<?>> (class-of-wildcard).
>>
>> All such changes would  indeed help making generic enums more useful
>> (and interoperable with EnumSet and friends), but whether all such
>> changes are actually "sound", that's a different story.
>>
>> For instance, code like:
>>
>> MyEnumSet<Option> set = MyEnumSet.allOf(Option.class)
>>
>> Would _still_ fail. You need the LHS to be _exactly_
>> MyEnumSet<Option<?>> for this to work. Which means graduating an enum
>> into a generic enum would still be a source incompatible change
>
>
>>
>> Cheers
>> Maurizio
>
>
> That's an excellent point. Doing the migration in a single step is source incompatible.
>
> However, it is possible to perform the migration in multiple steps, each step source
> compatible with the previous step, allowing for gradual migration. This would
> require multiple major releases of a library to complete. The result would be
> that at each step, clients can update the library without incompatibility, as long
> as they complete the required migration steps before upgrading to a major version
> that takes the next migration step.
>
> See https://github.com/Mooninaut/java-generic-enums/tree/main/src/main/java/org/duckdns/mooninaut/migration
> for a step-by-step example.
>
> Given a library that has an enum, which can usefully be migrated to a generic enum:
>
> Step 1:
> * Library changes method parameters of type "EnumSet<X>" (if any) to
>   "EnumSet<? extends X>". This change is source-compatible for clients.
> * Casts from "EnumSet<? extends X>" to "EnumSet<X>" may be
>   required inside library methods.
> * Suggestion: Some sort of @MigratingToGenericEnum annotation to prompt
>   clients to update references, ideally with tool support.
>
> Step 2:
> * Clients update library, and change variables of type "EnumSet<X>" to "EnumSet<? extends X>"
> * Both "EnumSet<X>" and "EnumSet<? extends X>" compile.
>
> Step 3:
> * Library makes X generic, updates methods that return "EnumSet<X>" to
>   return "EnumSet<X<?>>" This is source-compatible for clients that have completed
>   step 2, with an unchecked warning on "EnumSet.allOf(X.class)" and related methods.
> * Library methods may require casts from "EnumSet<? extends X>" to "EnumSet<X<?>>"
> * Library changes "EnumSet.allOf(X.class)" to "EnumSet.allOf(X.CONSTANT.getDeclaringClass())"
> * Library removes @MigratingToGenericEnum.
>
> Step 4:
> * Clients update library, change usages of "EnumSet<? extends X>" to "EnumSet<X<?>>"
>   and change "EnumSet.allOf(X.class)" to "EnumSet.allOf(X.CONSTANT.getDeclaringClass())"
> * Usages of "EnumSet<X>" now produce compilation errors.
> * Both "EnumSet<? extends X> set = EnumSet.allOf(X.class)" and
>   "EnumSet<X<?>> set = EnumSet.allOf(X.CONSTANT.getDeclaringClass())" compile.
> * Tools should prompt these changes when seeing use of a generic enum with old syntax.
>
> Step 5 (optional):
> * Library replaces "EnumSet<? extends X>" with "EnumSet<X<?>>" in method parameter types.
> * Library methods can no longer be called with values of type "EnumSet<? extends X>".
> * This is source-compatible with clients that have completed step 4.
> * No further client changes are required.
> * Casts to EnumSet<X<?>> are no longer required.
> * This step is optional. The only benefit is removing remaining casts.
>   Libraries can delay this step for as long as desired to allow clients time to complete step 4.
>
>
> This process is analogous to the gradual transition from a deprecated API to its replacement
> over several major versions. The non-generic syntax becomes "deprecated" at step 1, but
> still compiles, possibly with warnings, until step 4.
>
> Cheers,
> Clement
</pre></body></html>