mcimadamore@1415: /* mcimadamore@1415: * @test /nodynamiccopyright/ mcimadamore@1415: * @bug 8003280 mcimadamore@1415: * @summary Add lambda tests mcimadamore@1415: * check that candidates with cyclic type-inference are removed from the mcimadamore@1415: * set of applicable methods mcimadamore@1415: * @compile/fail/ref=TargetType21.out -XDrawDiagnostics TargetType21.java mcimadamore@1415: */ mcimadamore@1415: mcimadamore@1415: class TargetType21 { mcimadamore@1415: interface SAM1 { mcimadamore@1415: String m1(Integer n) throws Exception; mcimadamore@1415: } mcimadamore@1415: mcimadamore@1415: interface SAM2 { mcimadamore@1415: void m2(Integer n); mcimadamore@1415: } mcimadamore@1415: mcimadamore@1415: interface SAM3 { mcimadamore@1415: R m3(A n); mcimadamore@1415: } mcimadamore@1415: mcimadamore@1415: void call(SAM1 sam) { } mcimadamore@1415: void call(SAM2 sam) { } mcimadamore@1415: void call(SAM3 sam) { } mcimadamore@1415: mcimadamore@1415: void test() { mcimadamore@1480: call(x -> { throw new Exception(); }); //ambiguous mcimadamore@1510: call(x -> { System.out.println(""); }); //ambiguous mcimadamore@1510: call(x -> { return (Object) null; }); //cyclic inference mcimadamore@1510: call(x -> { return null; }); //ambiguous mcimadamore@1415: } mcimadamore@1415: }