class InLambda { static class Mine { @SuppressWarnings("nullness") // just a utility static Mine some() { return null; } } interface Function { R apply(T t); } interface Box {} static class Boxes { @SuppressWarnings("nullness") // just a utility static Box transform(Function function) { return null; } } class Infer { Box> f = Boxes.transform( el -> { return Mine.some(); }); } }