mcimadamore@1677: /* mcimadamore@1677: * @test /nodynamiccopyright/ mcimadamore@1677: * @bug 8009131 mcimadamore@1677: * @summary Overload: javac should discard methods that lead to errors in lambdas with implicit parameter types mcimadamore@1677: * @compile/fail/ref=TargetType66.out -XDrawDiagnostics TargetType66.java mcimadamore@1677: */ mcimadamore@1677: class TargetType66 { mcimadamore@1677: interface SAM1 { mcimadamore@1677: void m(String s); mcimadamore@1677: } mcimadamore@1677: mcimadamore@1677: interface SAM2 { mcimadamore@1677: void m(Integer s); mcimadamore@1677: } mcimadamore@1677: mcimadamore@1677: void g(SAM1 s1) { } mcimadamore@1677: void g(SAM2 s2) { } mcimadamore@1677: mcimadamore@1677: void test() { vromero@2000: g(x->{ String s = x; }); //ambiguous vromero@2000: g(x->{ Integer i = x; }); //ambiguous mcimadamore@1677: g(x->{ Object o = x; }); //ambiguous mcimadamore@1677: g(x->{ Character c = x; }); //error: inapplicable methods mcimadamore@1677: g(x->{ Character c = ""; }); //error: incompatible types mcimadamore@1677: } mcimadamore@1677: }