lambda syntax tutorial
Fredrik Ohrstrom
oehrstroem at gmail.com
Thu Aug 5 02:57:05 PDT 2010
>> The actual argument type list associated with a method reference is optional:
>>
>> Foo#baz
>>
>
> I think you can't do that because inserting an overloading method
> is a source backward compatible change.
That cannot be true. If I insert a more specified overloading method
into class Test,
clearly you will have to recompile the code that uses Test.
For example compile Test and Usage:
public class Test {
public static void foo(Object a) { System.err.println("Object"); }
//public static void foo(String a) { System.err.println("String"); }
}
public class Usage
{
public static void main(String... args) { Test.foo(""); }
}
Then recompile only Test but with foo(String) enabled. Obviously when
you run Usage it will still use foo(Object) since that is what is encoded
into the bytecode of Usage. The same will be true for the MethodHandle ldc.
> With this syntax, inserting an overloading method may break method
> references.
Any change to the overloading hierarchy will potentially break code that
uses the overloaded code. You have to recompile to get the static
references right.
> In my opinion, explicit syntax should be the only existing one.
No. This is a good syntax.
//Fredrik
More information about the lambda-dev
mailing list