Thu, 10 Oct 2013 14:58:04 +0200
8001931: The new build system whitespace cleanup
Reviewed-by: tbell, simonis, erikj
aoqi@0 | 1 | /* |
aoqi@0 | 2 | * @test /nodynamiccopyright/ |
aoqi@0 | 3 | * @bug 8003280 |
aoqi@0 | 4 | * @summary Add lambda tests |
aoqi@0 | 5 | * check that pair of bound/non-bound constructor references is flagged as ambiguous |
aoqi@0 | 6 | * @author Maurizio Cimadamore |
aoqi@0 | 7 | * @compile/fail/ref=MethodReference23.out -XDrawDiagnostics MethodReference23.java |
aoqi@0 | 8 | */ |
aoqi@0 | 9 | |
aoqi@0 | 10 | class MethodReference23 { |
aoqi@0 | 11 | |
aoqi@0 | 12 | class Inner1 { |
aoqi@0 | 13 | Inner1(MethodReference23 outer) {}; |
aoqi@0 | 14 | Inner1() {}; |
aoqi@0 | 15 | } |
aoqi@0 | 16 | |
aoqi@0 | 17 | static class Inner2 { |
aoqi@0 | 18 | Inner2(MethodReference23 outer) {}; |
aoqi@0 | 19 | Inner2() {}; |
aoqi@0 | 20 | } |
aoqi@0 | 21 | |
aoqi@0 | 22 | interface SAM11 { |
aoqi@0 | 23 | Inner1 m(MethodReference23 rec); |
aoqi@0 | 24 | } |
aoqi@0 | 25 | |
aoqi@0 | 26 | interface SAM12 { |
aoqi@0 | 27 | Inner1 m(); |
aoqi@0 | 28 | } |
aoqi@0 | 29 | |
aoqi@0 | 30 | interface SAM21 { |
aoqi@0 | 31 | Inner2 m(MethodReference23 rec); |
aoqi@0 | 32 | } |
aoqi@0 | 33 | |
aoqi@0 | 34 | interface SAM22 { |
aoqi@0 | 35 | Inner2 m(); |
aoqi@0 | 36 | } |
aoqi@0 | 37 | |
aoqi@0 | 38 | static void call11(SAM11 s) { } |
aoqi@0 | 39 | |
aoqi@0 | 40 | static void call12(SAM12 s) { } |
aoqi@0 | 41 | |
aoqi@0 | 42 | static void call21(SAM21 s) { } |
aoqi@0 | 43 | |
aoqi@0 | 44 | static void call22(SAM22 s) { } |
aoqi@0 | 45 | |
aoqi@0 | 46 | static void call3(SAM11 s) { } |
aoqi@0 | 47 | static void call3(SAM12 s) { } |
aoqi@0 | 48 | static void call3(SAM21 s) { } |
aoqi@0 | 49 | static void call3(SAM22 s) { } |
aoqi@0 | 50 | |
aoqi@0 | 51 | static void test11() { |
aoqi@0 | 52 | SAM11 s = MethodReference23.Inner1::new; //ok |
aoqi@0 | 53 | call11(MethodReference23.Inner1::new); //ok |
aoqi@0 | 54 | } |
aoqi@0 | 55 | |
aoqi@0 | 56 | static void test12() { |
aoqi@0 | 57 | SAM12 s = MethodReference23.Inner1::new; //fail |
aoqi@0 | 58 | call12(MethodReference23.Inner1::new); //fail |
aoqi@0 | 59 | } |
aoqi@0 | 60 | |
aoqi@0 | 61 | static void test21() { |
aoqi@0 | 62 | SAM21 s = MethodReference23.Inner2::new; //ok |
aoqi@0 | 63 | call21(MethodReference23.Inner2::new); //ok |
aoqi@0 | 64 | } |
aoqi@0 | 65 | |
aoqi@0 | 66 | static void test22() { |
aoqi@0 | 67 | SAM22 s = MethodReference23.Inner2::new; //ok |
aoqi@0 | 68 | call22(MethodReference23.Inner2::new); //ok |
aoqi@0 | 69 | } |
aoqi@0 | 70 | |
aoqi@0 | 71 | static void test3() { |
aoqi@0 | 72 | call3(MethodReference23.Inner2::new); //ambiguous |
aoqi@0 | 73 | } |
aoqi@0 | 74 | } |