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 8007462
4 * @summary Fix provisional applicability for method references
5 * @compile/fail/ref=TargetType60.out -XDrawDiagnostics TargetType60.java
6 */
7 class TargetType60 {
9 interface Sam0 {
10 void m();
11 }
13 interface Sam1<X> {
14 void m(X x);
15 }
17 interface Sam2<X,Y> {
18 void m(X x, Y y);
19 }
21 void m0() { }
22 void m1(String s) { }
23 void m2(String s1, String s2) { }
25 void m01() { }
26 void m01(String s) { }
28 void m012() { }
29 void m012(String s) { }
30 void m012(String s1, String s2) { }
32 void n0() { }
33 void n1(String s) { }
34 void n2(TargetType60 rec, String s2) { }
36 void n01() { }
37 void n01(String s) { }
39 void n012() { }
40 void n012(String s) { }
41 void n012(TargetType60 rec, String s2) { }
43 static String g(Sam0 s) { return null; }
44 static <U> U g(Sam1<U> s) { return null; }
45 static <U> U g(Sam2<U,String> s) { return null; }
47 static <U> U u(Sam1<U> s) { return null; }
48 static <U> U u(Sam2<U,String> s) { return null; }
50 void testBound() {
51 String s1 = g(this::m0); //ok - resolves to g(Sam0)
52 String s2 = g(this::m1); //ok - resolves to g(Sam1)
53 String s3 = g(this::m2); //ok - resolves to g(Sam2)
54 String s4 = g(this::m01);//ambiguous (g(Sam0), g(Sam1) apply)
55 String s5 = g(this::m012);//ambiguous (g(Sam0), g(Sam1), g(Sam2) apply)
56 }
58 static void testUnbound() {
59 TargetType60 s1 = u(TargetType60::n0); //ok - resolves to u(Sam1)
60 TargetType60 s2 = u(TargetType60::n1); //ambiguous (u(Sam1), u(Sam2) apply)
61 TargetType60 s3 = u(TargetType60::n2); //none is applicable
62 TargetType60 s4 = u(TargetType60::n01);//ambiguous (u(Sam1), u(Sam2) apply)
63 TargetType60 s5 = u(TargetType60::n012);//ambiguous (u(Sam1), u(Sam2) apply)
64 }
65 }