Method references in annotations?

Jason Schroeder shrode at
Mon Aug 15 15:56:39 PDT 2011


Since I now read that there are internal conversations, any
implementation experiment
I have here is noise, until those email threads appear.

To answer your question:

The signature of Method.invoke implements all methods.  And therefore
the signature of Method.invoke is the uninteresting, unused SAM for
all methods in Java.  So for the purpose of boxing a method reference,
and not adding a plain literal hack of "Method m =," it is
possible to explore the ramifications of making a SAM interface for
Method.invoke and expecting an optimization/special-case of:

MethodInvoke m =

to play by the rules of SAM but return the actual Method.   As a
starting point, then one can begin to elide the needs for some
similarity across method references by specifying a boxing-like rule.
 My aim was to reach into MethodHandles and get the annotation
requirement for free.


On Sun, Aug 14, 2011 at 2:46 PM, Neal Gafter <neal at> wrote:
> I am not sure what you're trying to say in this message.  Method.invoke is a
> method.  SAMs are interface types.  I don't know what it means to treat a
> method as a type.  Do you mean to suggest treating java.lang.Method as a
> SAM?  It has little in common with them.

More information about the lambda-dev mailing list