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 pair of bound/non-bound method references checked correctly
6 * @author Maurizio Cimadamore
7 * @compile/fail/ref=MethodReference22.out -XDrawDiagnostics MethodReference22.java
8 */
10 class MethodReference22 {
12 void m1(String x) { }
13 void m1(MethodReference22 rec, String x) { }
15 static void m2(String x) { }
16 static void m2(MethodReference22 rec, String x) { }
18 static void m3(String x) { }
19 void m3(MethodReference22 rec, String x) { }
21 void m4(String x) { }
22 static void m4(MethodReference22 rec, String x) { }
24 interface SAM1 {
25 void m(String x);
26 }
28 interface SAM2 {
29 void m(MethodReference22 rec, String x);
30 }
32 static void call1(SAM1 s) { }
34 static void call2(SAM2 s) { }
36 static void call3(SAM1 s) { }
37 static void call3(SAM2 s) { }
39 static void test1() {
40 SAM1 s1 = MethodReference22::m1; //fail
41 call1(MethodReference22::m1); //fail
42 SAM1 s2 = MethodReference22::m2; //ok
43 call1(MethodReference22::m2); //ok
44 SAM1 s3 = MethodReference22::m3; //ok
45 call1(MethodReference22::m3); //ok
46 SAM1 s4 = MethodReference22::m4; //fail
47 call1(MethodReference22::m4); //fail
48 }
50 static void test2() {
51 SAM2 s1 = MethodReference22::m1; //ambiguous
52 call2(MethodReference22::m1); //ambiguous
53 SAM2 s2 = MethodReference22::m2; //ambiguous
54 call2(MethodReference22::m2); //ambiguous
55 SAM2 s3 = MethodReference22::m3; //ambiguous
56 call2(MethodReference22::m3); //ambiguous
57 SAM2 s4 = MethodReference22::m4; //ambiguous
58 call2(MethodReference22::m4); //ambiguous
59 }
61 static void test3() {
62 call3(MethodReference22::m1); //fail
63 call3(MethodReference22::m2); //ok
64 call3(MethodReference22::m3); //ok
65 call3(MethodReference22::m4); //fail
66 }
67 }