Method references in annotations

Brian Goetz brian.goetz at oracle.com
Tue Nov 13 14:26:20 UTC 2018


The story here is: we’ve completed our analysis on the feature, and concluded that the feature is sound (many such features don’t survive this cut.)  But, there is actually quite a bit of work needed in the underlying infrastructure to implement it, largely having to do with annotation processing in the VM, and reflection.  As a result, the amount of work went up, which pushed its cost/benefit ratio down.  It is still on the list, but hasn’t been prioritized.  

If someone with VM and reflection skills wanted to step up and help implement it, that might move the balance back in the other direction.  

> On Nov 7, 2018, at 8:17 PM, Julian Ruppel <ruppel.julian at gmail.com> wrote:
> 
> Hi,
> 
> being aware that there has been a discussion quite some time ago (
> http://mail.openjdk.java.net/pipermail/lambda-dev/2011-August/003768.html)
> I wanted to come up again with this topic as this feature would be
> beneficial especially for framework developers who wants to appoint
> behaviour to annotations.
> 
> The following snippet shows what I want to vote for.
> 
> @MyAnnotation(method = MyClass::myMethod)private String myVariable;
> 
> This would be far more type-safe compared to using string literals to find
> the method via reflection.
> 
> 
> - Julian



More information about the core-libs-dev mailing list