mcimadamore@1415: /* mcimadamore@1415: * @test /nodynamiccopyright/ mcimadamore@1415: * @bug 8003280 mcimadamore@1415: * @summary Add lambda tests mcimadamore@1415: * check case of ambiguous method call with lambda whose body cannot mcimadamore@1415: complete normally mcimadamore@1415: * @compile/fail/ref=TargetType23.out -XDrawDiagnostics TargetType23.java mcimadamore@1415: */ mcimadamore@1415: mcimadamore@1415: class TargetType23 { mcimadamore@1415: mcimadamore@1415: interface Sam0 { mcimadamore@1415: void m(); mcimadamore@1415: } mcimadamore@1415: mcimadamore@1415: interface Sam1 { mcimadamore@1415: int m(); mcimadamore@1415: } mcimadamore@1415: mcimadamore@1415: interface Sam2 { mcimadamore@1415: String m(); mcimadamore@1415: } mcimadamore@1415: mcimadamore@1415: interface Sam3 { mcimadamore@1415: A m(); mcimadamore@1415: } mcimadamore@1415: mcimadamore@1415: mcimadamore@1415: void call(Sam0 s) { } mcimadamore@1415: void call(Sam1 s) { } mcimadamore@1415: void call(Sam2 s) { } mcimadamore@1415: void call(Sam3 s) { } mcimadamore@1415: dlsmith@2395: void call2(Sam0 s) { } dlsmith@2395: void call2(Sam2 s) { } dlsmith@2395: void call2(Sam3 s) { } dlsmith@2395: mcimadamore@1415: void test() { dlsmith@2395: call(()-> { throw new RuntimeException(); }); // ambiguous - call(Sam1) vs. call(Sam2) dlsmith@2395: call2(()-> { throw new RuntimeException(); }); // ok mcimadamore@1415: } mcimadamore@1415: }