Method references with types [Re: lambda syntax tutorial]
Paul Benedict
pbenedict at apache.org
Thu Aug 5 14:59:45 PDT 2010
On Thu, Aug 5, 2010 at 4:58 PM, Rémi Forax <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
More information about the lambda-dev
mailing list