Thu, 10 Oct 2013 14:58:04 +0200
8001931: The new build system whitespace cleanup
Reviewed-by: tbell, simonis, erikj
1 /*
2 * @test /nodynamiccopyright/
3 * @bug 8003280
4 * @summary Add lambda tests
5 * check that candidates with incompatible SAM descriptor args length
6 are removed from the set of applicable methods
7 * @compile/fail/ref=TargetType22.out -Xlint:unchecked -XDrawDiagnostics TargetType22.java
8 */
10 class TargetType22 {
12 interface Sam0 {
13 void m();
14 }
16 interface Sam1<A> {
17 void m(A a);
18 }
20 interface Sam2<A> {
21 void m(A a1, A a2);
22 }
24 interface Sam3<A> {
25 void m(A a1, A a2, A a3);
26 }
28 interface SamX<A> {
29 void m(A... as);
30 }
32 void call(Sam0 s) { }
33 void call(Sam1<String> s) { }
34 void call(Sam2<String> s) { }
35 void call(Sam3<String> s) { }
36 void call(SamX<String> s) { }
38 void test() {
39 call(() -> { });
40 call(a1 -> { }); //ambiguous - both call(Sam1) and call(SamX) match
41 call((a1, a2) -> { });
42 call((a1, a2, a3) -> { });
43 }
44 }