Relates :
|
|
Relates :
|
|
Relates :
|
The following compiles with javac 8 b121: static void m(Object dummy, int arg) { System.out.println("int"); } static void m(Object dummy, Integer arg) { System.out.println("Integer"); } public static void main(String... args) { m(0, 23); m(0, Integer.valueOf(23)); } (The first invocation prints "int"; the second prints "Integer".) This was an experimental feature in Lambda that we ultimately agreed to undo for 8. The return expressions of _lambdas_ should continue to get special treatment, but a top-level argument should not. The only mechanism for treating one parameter type as better than another in this case should be subtyping.
|