<html><body><div style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: #000000"><div><br></div><div><br></div><hr id="zwchr" data-marker="__DIVIDER__"><div data-marker="__HEADERS__"><blockquote style="border-left:2px solid #1010FF;margin-left:5px;padding-left:5px;color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;"><b>From: </b>"Kasper Nielsen" <kasperni@gmail.com><br><b>To: </b>"Archie Cobbs" <archie.cobbs@gmail.com><br><b>Cc: </b>"David Alayachew" <davidalayachew@gmail.com>, "amber-dev" <amber-dev@openjdk.org><br><b>Sent: </b>Thursday, October 17, 2024 5:08:38 PM<br><b>Subject: </b>Re: Are there any downsides if we add Enum.name() to the list of constant expressions in the JLS?<br></blockquote></div><div data-marker="__QUOTED_TEXT__"><blockquote style="border-left:2px solid #1010FF;margin-left:5px;padding-left:5px;color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;"><div><div>Hi,
I know this feature has been requested a number of times. But I want to add one more usecase.
There is common pattern in many frameworks of specifying a factory class in an annotation <a href="http://a.la" target="_blank">a.la</a>. </div><div dir="auto"><br></div><div dir="auto"> @SomeFrameworkAnnotation(factory = MyAppFactory.class)</div><div dir="auto"><br></div><div dir="auto">Unfortunately, this pattern requires some more effort, if you want to use it together with modules.
Either you need to open the package or handoff a Lookup object to the framework in some way.
While this isn't super complicated, it would ease the on-ramp if you could simply use </div><div dir="auto"><br></div><div dir="auto"> @SomeFrameworkAnnotation(factory = MyAppFactory::new) </div><div dir="auto"><br></div><div dir="auto"> I know this type of "annotation programming" aren't really used in the JDK, but in Java's wider ecosystem I see it a lot. </div></div></blockquote><div><br></div><div>And this is not necessary a good thing.<br></div><div><br data-mce-bogus="1"></div><div>With my teacher hat, using annotations for the configuration usually means that the configuration is scattered into several files and and which make it hard to find/understand, fixing configuration issues in student enterprisy code is a pain because of that.</div><div><br data-mce-bogus="1"></div><div>So i've no problem with annotations being used to specify additional semantics @Entity, @Transactional etc but using annotations for specifying configuration, for me, is a step too far.</div><div><br data-mce-bogus="1"></div><blockquote style="border-left:2px solid #1010FF;margin-left:5px;padding-left:5px;color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;"><div><div dir="auto"><br></div><div dir="auto"> Best,
Kasper</div></div></blockquote><div><br></div><div>Rémi<br data-mce-bogus="1"></div><div><br data-mce-bogus="1"></div><blockquote style="border-left:2px solid #1010FF;margin-left:5px;padding-left:5px;color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;"><div><br></div><div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;padding-left:1ex;border-left-color:rgb(204,204,204)"><div dir="ltr"><div class="gmail_quote"><br><div>Idea: What about allowing lambda values for Class-valued annotation properties when the Class is a functional interface?</div></div></div></blockquote></div></div><br></blockquote></div></div></body></html>