Method references with types [Re: lambda syntax tutorial]

Paul Benedict pbenedict at apache.org
Fri Aug 6 08:40:54 PDT 2010


Remi,

That's pretty cool!! Does supporting a conversion to java.lang.reflect types
make a difference? I still think so because it's part of the public api, but
what are your thoughts on it?

Paul

On Fri, Aug 6, 2010 at 10:38 AM, Rémi Forax <forax at univ-mlv.fr> wrote:

>  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> 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