Method references with types [Re: lambda syntax tutorial]
Rémi Forax
forax at univ-mlv.fr
Fri Aug 6 08:38:41 PDT 2010
Le 05/08/2010 23:59, Paul Benedict a écrit :
> On Thu, Aug 5, 2010 at 4:58 PM, Rémi Forax <forax at univ-mlv.fr
> <mailto:forax at univ-mlv.fr>> wrote:
>
> In fact, it will be something like
>
> java.dyn.MethodHandle mh = String#length();
>
>
> Okay, so I would add that too and allow three conversions. I don't
> think casting to reflected methods/fields should be forgotten. I
> understand why JSR-292 wants to MethodHandles -- that makes sense and
> I support it. But there is so much code today built around reflection,
> and being able to cast to those classes would be added value.
>
> // automatic SAM conversion
> Arrays.sortBy(strings, String#length());
>
> // automatic reflected method conversion
> java.lang.reflect.Method m = String#length();
>
> // automatic invokedynamic conversion
> java.dyn.MethodHandle mh = String#length();
>
> Paul
Paul,
there is a secret plan to rewrite java.lang.Method and java.lang.Field
using MethodHandle to do the plumbing.
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6824466
Rémi
More information about the lambda-dev
mailing list