Method references in annotations

Julian Ruppel ruppel.julian at gmail.com
Wed Nov 7 19:17:54 UTC 2018


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