import org.jspecify.annotations.NonNull;
import org.jspecify.annotations.NullMarked;
import org.jspecify.annotations.NullUnmarked;
import org.jspecify.annotations.Nullable;
@NullMarked
class Test {
interface Foo<T extends @Nullable Object> {}
@NullUnmarked
static <T> T identity(Foo<@NonNull T> t) {
throw new RuntimeException("not implemented");
}
void test(Foo<@Nullable String> s) {
String x = identity(s); // we should report an error here
}
}
Right now we do not report an error at the identity call, but we should, since the restrictive @NonNull annotation in the Foo<@NonNull T> parameter type means you cannot pass Foo<@Nullable String>.