import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; class C { void f() { I i = (@Nullable String o) -> { if (o != null) { if (o instanceof String) { o = "4"; } else { System.out.println(o); } g(o); } return ""; }; } void g(@NotNull Object o) { } interface I { R m(T t); } }