mcimadamore@1415: /* vromero@2370: * @test /nodynamiccopyright/ vromero@2370: * @bug 8003280 8029718 mcimadamore@1415: * @summary Add lambda tests mcimadamore@1415: * check overload resolution and target type inference w.r.t. generic methods vromero@2370: * Should always use lambda body structure to disambiguate overload resolution mcimadamore@1415: * @author Maurizio Cimadamore vromero@2000: * @compile/fail/ref=TargetType02.out -XDrawDiagnostics TargetType02.java mcimadamore@1415: */ mcimadamore@1415: mcimadamore@1415: public class TargetType02 { mcimadamore@1415: mcimadamore@1415: interface S1 { mcimadamore@1415: X m(Integer x); mcimadamore@1415: } mcimadamore@1415: mcimadamore@1415: interface S2 { mcimadamore@1415: abstract X m(Integer x); mcimadamore@1415: } mcimadamore@1415: vromero@2000: static void call1(S1 s) { } vromero@2000: vromero@2000: static void call2(S2 s) { } vromero@2000: vromero@2000: static void call3(S1 s) { } vromero@2000: static void call3(S2 s) { } mcimadamore@1415: vromero@2370: static Z call4(S1 s) { return null; } vromero@2370: static Z call4(S2 s) { return null; } vromero@2370: mcimadamore@1415: void test() { vromero@2000: call1(i -> { toString(); return i; }); vromero@2000: call2(i -> { toString(); return i; }); vromero@2000: call3(i -> { toString(); return i; }); vromero@2370: call3(i -> { vromero@2370: toString(); vromero@2370: return call4(j -> { vromero@2370: return j; vromero@2370: }); vromero@2370: }); mcimadamore@1415: } mcimadamore@1415: }