<!DOCTYPE html><html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<font size="4" face="monospace">Yes, this is a frequent request.
And our analysis of this remains: it is reasonable from a
linguistic point of view, but the implementation is hellaciously
intrusive (as it cuts through all the layers mentioned), and so
ends up having a relatively poor return-on-investment compared to
other improvements.</font><br>
<br>
<br>
<div class="moz-cite-prefix">On 10/17/2024 11:08 AM, Kasper Nielsen
wrote:<br>
</div>
<blockquote type="cite" cite="mid:CAPs6150dr6jEDb6wA4Neat86HkkXsYUYkQ4jYoLqftLJ88n6bw@mail.gmail.com">
<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" moz-do-not-send="true">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 dir="auto"><br>
</div>
<div dir="auto"> Best, Kasper</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">
<div><br>
</div>
<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>
</blockquote>
<br>
</body>
</html>