<p dir="ltr">Thank you for your response Archie. This was exactly the type of response I was looking for.</p>
<p dir="ltr">So, folks leaning on the fact that enum names are not constant might get burned. I agree, these are oddballs. In fact, I would go further and call this a misuse of the API, but if the line is "no breaking backwards compatibility!", then I accept this as a dealbreaker.</p>
<p dir="ltr">As for the upsides, my personal use case is that I plan to use this for annotations. There's a couple of benefits, like grouping relevant pieces of information and methods together under the same enum value. Using valueOf(), I can derive a lot of information back from it, allowing me to add a whole bunch of information with a single source of truth. That has been the cause of a lot of bugs for me lately, and the only way to achieve something similar is to do something like nested classes or fake an enum. Why not just use the real thing?</p>
<br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Oct 16, 2024, 9:33 PM Archie Cobbs <<a href="mailto:archie.cobbs@gmail.com">archie.cobbs@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div dir="ltr">On Wed, Oct 16, 2024 at 8:33 PM Archie Cobbs <<a href="mailto:archie.cobbs@gmail.com" target="_blank" rel="noreferrer">archie.cobbs@gmail.com</a>> wrote:</div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr">On Wed, Oct 16, 2024 at 7:09 PM David Alayachew <<a href="mailto:davidalayachew@gmail.com" target="_blank" rel="noreferrer">davidalayachew@gmail.com</a>> wrote:</div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="auto">Now, to my question -- are there any downsides or obstacles to adding Enum.name() to this list of constant expressions?</div></blockquote><div><br></div><div>Just to clarify, this could only work for enum constant literals, e.g., <span style="font-family:monospace">FOOBAR.name()</span> which would obviously have value <span style="font-family:monospace">"foobar"</span>.</div></div></div></blockquote><div><br></div><div>Oops, I meant "FOOBAR" ...</div></div><div class="gmail_quote"><br clear="all"></div><span class="gmail_signature_prefix">-- </span><br><div dir="ltr" class="gmail_signature">Archie L. Cobbs<br></div></div>
</blockquote></div>