Thu, 10 Oct 2013 14:58:04 +0200
8001931: The new build system whitespace cleanup
Reviewed-by: tbell, simonis, erikj
mcimadamore@1581 | 1 | /* |
mcimadamore@1581 | 2 | * @test /nodynamiccopyright/ |
mcimadamore@1581 | 3 | * @bug 8007462 |
mcimadamore@1581 | 4 | * @summary Fix provisional applicability for method references |
mcimadamore@1581 | 5 | * @compile/fail/ref=TargetType60.out -XDrawDiagnostics TargetType60.java |
mcimadamore@1581 | 6 | */ |
mcimadamore@1581 | 7 | class TargetType60 { |
mcimadamore@1581 | 8 | |
mcimadamore@1581 | 9 | interface Sam0 { |
mcimadamore@1581 | 10 | void m(); |
mcimadamore@1581 | 11 | } |
mcimadamore@1581 | 12 | |
mcimadamore@1581 | 13 | interface Sam1<X> { |
mcimadamore@1581 | 14 | void m(X x); |
mcimadamore@1581 | 15 | } |
mcimadamore@1581 | 16 | |
mcimadamore@1581 | 17 | interface Sam2<X,Y> { |
mcimadamore@1581 | 18 | void m(X x, Y y); |
mcimadamore@1581 | 19 | } |
mcimadamore@1581 | 20 | |
mcimadamore@1581 | 21 | void m0() { } |
mcimadamore@1581 | 22 | void m1(String s) { } |
mcimadamore@1581 | 23 | void m2(String s1, String s2) { } |
mcimadamore@1581 | 24 | |
mcimadamore@1581 | 25 | void m01() { } |
mcimadamore@1581 | 26 | void m01(String s) { } |
mcimadamore@1581 | 27 | |
mcimadamore@1581 | 28 | void m012() { } |
mcimadamore@1581 | 29 | void m012(String s) { } |
mcimadamore@1581 | 30 | void m012(String s1, String s2) { } |
mcimadamore@1581 | 31 | |
mcimadamore@1610 | 32 | void n0() { } |
mcimadamore@1610 | 33 | void n1(String s) { } |
mcimadamore@1610 | 34 | void n2(TargetType60 rec, String s2) { } |
mcimadamore@1610 | 35 | |
mcimadamore@1610 | 36 | void n01() { } |
mcimadamore@1610 | 37 | void n01(String s) { } |
mcimadamore@1610 | 38 | |
mcimadamore@1610 | 39 | void n012() { } |
mcimadamore@1610 | 40 | void n012(String s) { } |
mcimadamore@1610 | 41 | void n012(TargetType60 rec, String s2) { } |
mcimadamore@1610 | 42 | |
mcimadamore@1581 | 43 | static String g(Sam0 s) { return null; } |
mcimadamore@1581 | 44 | static <U> U g(Sam1<U> s) { return null; } |
mcimadamore@1581 | 45 | static <U> U g(Sam2<U,String> s) { return null; } |
mcimadamore@1581 | 46 | |
mcimadamore@1610 | 47 | static <U> U u(Sam1<U> s) { return null; } |
mcimadamore@1610 | 48 | static <U> U u(Sam2<U,String> s) { return null; } |
mcimadamore@1610 | 49 | |
mcimadamore@1581 | 50 | void testBound() { |
mcimadamore@1581 | 51 | String s1 = g(this::m0); //ok - resolves to g(Sam0) |
mcimadamore@1581 | 52 | String s2 = g(this::m1); //ok - resolves to g(Sam1) |
mcimadamore@1581 | 53 | String s3 = g(this::m2); //ok - resolves to g(Sam2) |
mcimadamore@1581 | 54 | String s4 = g(this::m01);//ambiguous (g(Sam0), g(Sam1) apply) |
mcimadamore@1581 | 55 | String s5 = g(this::m012);//ambiguous (g(Sam0), g(Sam1), g(Sam2) apply) |
mcimadamore@1581 | 56 | } |
mcimadamore@1581 | 57 | |
mcimadamore@1581 | 58 | static void testUnbound() { |
mcimadamore@1610 | 59 | TargetType60 s1 = u(TargetType60::n0); //ok - resolves to u(Sam1) |
mcimadamore@1610 | 60 | TargetType60 s2 = u(TargetType60::n1); //ambiguous (u(Sam1), u(Sam2) apply) |
mcimadamore@1610 | 61 | TargetType60 s3 = u(TargetType60::n2); //none is applicable |
mcimadamore@1610 | 62 | TargetType60 s4 = u(TargetType60::n01);//ambiguous (u(Sam1), u(Sam2) apply) |
mcimadamore@1610 | 63 | TargetType60 s5 = u(TargetType60::n012);//ambiguous (u(Sam1), u(Sam2) apply) |
mcimadamore@1581 | 64 | } |
mcimadamore@1581 | 65 | } |