Example:
@NullMarked
class SampleNullUnmarkedCall {
@NullUnmarked
static class Foo<T> {
Foo(T t) {}
static <U> Foo<U> id(U u) { return new Foo<>(u); }
}
static void test() {
// should report no error
Foo<@Nullable Object> x = Foo.id(null);
}
}
Here, since Foo is @NullUnmarked, we can infer @Nullable Object as the type argument for the Foo.id(null) call, even though U (and T) do not have explicit @Nullable upper bounds.
Example:
Here, since
Foois@NullUnmarked, we can infer@Nullable Objectas the type argument for theFoo.id(null)call, even thoughU(andT) do not have explicit@Nullableupper bounds.