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