mcimadamore@1581: /* mcimadamore@1581: * @test /nodynamiccopyright/ mcimadamore@1581: * @bug 8007462 mcimadamore@1581: * @summary Fix provisional applicability for method references mcimadamore@1581: * @compile/fail/ref=TargetType60.out -XDrawDiagnostics TargetType60.java mcimadamore@1581: */ mcimadamore@1581: class TargetType60 { mcimadamore@1581: mcimadamore@1581: interface Sam0 { mcimadamore@1581: void m(); mcimadamore@1581: } mcimadamore@1581: mcimadamore@1581: interface Sam1 { mcimadamore@1581: void m(X x); mcimadamore@1581: } mcimadamore@1581: mcimadamore@1581: interface Sam2 { mcimadamore@1581: void m(X x, Y y); mcimadamore@1581: } mcimadamore@1581: mcimadamore@1581: void m0() { } mcimadamore@1581: void m1(String s) { } mcimadamore@1581: void m2(String s1, String s2) { } mcimadamore@1581: mcimadamore@1581: void m01() { } mcimadamore@1581: void m01(String s) { } mcimadamore@1581: mcimadamore@1581: void m012() { } mcimadamore@1581: void m012(String s) { } mcimadamore@1581: void m012(String s1, String s2) { } mcimadamore@1581: mcimadamore@1610: void n0() { } mcimadamore@1610: void n1(String s) { } mcimadamore@1610: void n2(TargetType60 rec, String s2) { } mcimadamore@1610: mcimadamore@1610: void n01() { } mcimadamore@1610: void n01(String s) { } mcimadamore@1610: mcimadamore@1610: void n012() { } mcimadamore@1610: void n012(String s) { } mcimadamore@1610: void n012(TargetType60 rec, String s2) { } mcimadamore@1610: mcimadamore@1581: static String g(Sam0 s) { return null; } mcimadamore@1581: static U g(Sam1 s) { return null; } mcimadamore@1581: static U g(Sam2 s) { return null; } mcimadamore@1581: mcimadamore@1610: static U u(Sam1 s) { return null; } mcimadamore@1610: static U u(Sam2 s) { return null; } mcimadamore@1610: mcimadamore@1581: void testBound() { mcimadamore@1581: String s1 = g(this::m0); //ok - resolves to g(Sam0) mcimadamore@1581: String s2 = g(this::m1); //ok - resolves to g(Sam1) mcimadamore@1581: String s3 = g(this::m2); //ok - resolves to g(Sam2) mcimadamore@1581: String s4 = g(this::m01);//ambiguous (g(Sam0), g(Sam1) apply) mcimadamore@1581: String s5 = g(this::m012);//ambiguous (g(Sam0), g(Sam1), g(Sam2) apply) mcimadamore@1581: } mcimadamore@1581: mcimadamore@1581: static void testUnbound() { mcimadamore@1610: TargetType60 s1 = u(TargetType60::n0); //ok - resolves to u(Sam1) mcimadamore@1610: TargetType60 s2 = u(TargetType60::n1); //ambiguous (u(Sam1), u(Sam2) apply) mcimadamore@1610: TargetType60 s3 = u(TargetType60::n2); //none is applicable mcimadamore@1610: TargetType60 s4 = u(TargetType60::n01);//ambiguous (u(Sam1), u(Sam2) apply) mcimadamore@1610: TargetType60 s5 = u(TargetType60::n012);//ambiguous (u(Sam1), u(Sam2) apply) mcimadamore@1581: } mcimadamore@1581: }