<div dir="auto">Agree. Placing an executable code into annotations sounds quite wild. I could not imagine how should stack trace look like... Or adding a break point?.. debugger?<div dir="auto">IDE refactorings? Code coverage tools?</div><div dir="auto"><br></div><div dir="auto">Too much magic. No, thank you.</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, 18 Oct 2024, 10:33 Remi Forax, <<a href="mailto:forax@univ-mlv.fr">forax@univ-mlv.fr</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div style="font-family:arial,helvetica,sans-serif;font-size:12pt;color:#000000"><div><br></div><div><br></div><hr id="m_5486038532929622165zwchr"><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"><b>From: </b>"Kasper Nielsen" <<a href="mailto:kasperni@gmail.com" target="_blank" rel="noreferrer">kasperni@gmail.com</a>><br><b>To: </b>"Archie Cobbs" <<a href="mailto:archie.cobbs@gmail.com" target="_blank" rel="noreferrer">archie.cobbs@gmail.com</a>><br><b>Cc: </b>"David Alayachew" <<a href="mailto:davidalayachew@gmail.com" target="_blank" rel="noreferrer">davidalayachew@gmail.com</a>>, "amber-dev" <<a href="mailto:amber-dev@openjdk.org" target="_blank" rel="noreferrer">amber-dev@openjdk.org</a>><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><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" rel="noreferrer">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></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></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></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></div><div><br></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></div></blockquote></div>