lambda and MethodHandles in current prototype
Peter Levart
peter.levart at gmail.com
Sun Nov 20 10:58:06 PST 2011
I tried the prototype in binary distribution and was surprised that the following code:
import java.lang.invoke.MethodHandleProxies;
import java.util.functions.IntOperator;
public class Test
{
static int sum(int a, int b)
{
return a + b;
}
public static void main(String[] args)
{
IntOperator sum1 = (a, b) -> a + b;
IntOperator sum2 = Test#sum;
System.out.println(MethodHandleProxies.isWrapperInstance(sum1));
System.out.println(MethodHandleProxies.isWrapperInstance(sum2));
}
}
prints:
false
false
Has the compilation strategy changed? Aren't MethodHandles used any more or are they still, but the conversion to functional interfaces doesn't use MethodHandleProxies.asInterfaceInstance()? Are there any plans for the above code to print true/true (or at least false/true)?
Regards,
Peter
More information about the lambda-dev
mailing list