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 constructor references is flagged as ambiguous
6 * @author Maurizio Cimadamore
7 * @compile/fail/ref=MethodReference23.out -XDrawDiagnostics MethodReference23.java
8 */
10 class MethodReference23 {
12 class Inner1 {
13 Inner1(MethodReference23 outer) {};
14 Inner1() {};
15 }
17 static class Inner2 {
18 Inner2(MethodReference23 outer) {};
19 Inner2() {};
20 }
22 interface SAM11 {
23 Inner1 m(MethodReference23 rec);
24 }
26 interface SAM12 {
27 Inner1 m();
28 }
30 interface SAM21 {
31 Inner2 m(MethodReference23 rec);
32 }
34 interface SAM22 {
35 Inner2 m();
36 }
38 static void call11(SAM11 s) { }
40 static void call12(SAM12 s) { }
42 static void call21(SAM21 s) { }
44 static void call22(SAM22 s) { }
46 static void call3(SAM11 s) { }
47 static void call3(SAM12 s) { }
48 static void call3(SAM21 s) { }
49 static void call3(SAM22 s) { }
51 static void test11() {
52 SAM11 s = MethodReference23.Inner1::new; //ok
53 call11(MethodReference23.Inner1::new); //ok
54 }
56 static void test12() {
57 SAM12 s = MethodReference23.Inner1::new; //fail
58 call12(MethodReference23.Inner1::new); //fail
59 }
61 static void test21() {
62 SAM21 s = MethodReference23.Inner2::new; //ok
63 call21(MethodReference23.Inner2::new); //ok
64 }
66 static void test22() {
67 SAM22 s = MethodReference23.Inner2::new; //ok
68 call22(MethodReference23.Inner2::new); //ok
69 }
71 static void test3() {
72 call3(MethodReference23.Inner2::new); //ambiguous
73 }
74 }