Thu, 21 Feb 2013 15:27:05 +0000
8008444: Inherited generic functional descriptors are merged incorrectly
Summary: Missing call to Types.createMethodWithThrownTypes
Reviewed-by: jjg
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@1581 | 32 | static String g(Sam0 s) { return null; } |
mcimadamore@1581 | 33 | static <U> U g(Sam1<U> s) { return null; } |
mcimadamore@1581 | 34 | static <U> U g(Sam2<U,String> s) { return null; } |
mcimadamore@1581 | 35 | |
mcimadamore@1581 | 36 | void testBound() { |
mcimadamore@1581 | 37 | String s1 = g(this::m0); //ok - resolves to g(Sam0) |
mcimadamore@1581 | 38 | String s2 = g(this::m1); //ok - resolves to g(Sam1) |
mcimadamore@1581 | 39 | String s3 = g(this::m2); //ok - resolves to g(Sam2) |
mcimadamore@1581 | 40 | String s4 = g(this::m01);//ambiguous (g(Sam0), g(Sam1) apply) |
mcimadamore@1581 | 41 | String s5 = g(this::m012);//ambiguous (g(Sam0), g(Sam1), g(Sam2) apply) |
mcimadamore@1581 | 42 | } |
mcimadamore@1581 | 43 | |
mcimadamore@1581 | 44 | static void testUnbound() { |
mcimadamore@1581 | 45 | TargetType60 s1 = g(TargetType60::m0); //ok - resolves to g(Sam1) |
mcimadamore@1581 | 46 | TargetType60 s2 = g(TargetType60::m1); //ok - resolves to g(Sam2) |
mcimadamore@1581 | 47 | TargetType60 s3 = g(TargetType60::m2); //none is applicable |
mcimadamore@1581 | 48 | TargetType60 s4 = g(TargetType60::m01);//ambiguous (g(Sam1), g(Sam2) apply) |
mcimadamore@1581 | 49 | TargetType60 s5 = g(TargetType60::m012);//ambiguous (g(Sam1), g(Sam2) apply) |
mcimadamore@1581 | 50 | } |
mcimadamore@1581 | 51 | } |