mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-21 17:52:27 +07:00
Fixes IDEA-372347 Java type inference should respect nullability Fixes IDEA-368244 Unexpected warnings when using @Nullable generic type bounds in @NullMarked context Fixes IDEA-372223 Nullability inference for generic parameters Fixes IDEA-367232 'Argument might be null' warning on JSpecify nullable enum GitOrigin-RevId: 12745f82e22fadb35e23ad73f330501146c86b86
30 lines
699 B
Java
30 lines
699 B
Java
import org.jetbrains.annotations.Nullable;
|
|
|
|
import java.util.Objects;
|
|
import java.util.stream.Stream;
|
|
|
|
class Main {
|
|
public static void main(String[] args) {
|
|
Stream.of("test1")
|
|
.map(Main::testNullableStaticMethod)
|
|
.map(Objects::requireNonNull);
|
|
|
|
Stream.of("test2")
|
|
.map(Main::testNullableStaticMethod)
|
|
.map(obj -> Objects.requireNonNull(obj));
|
|
|
|
Stream.of("test3")
|
|
.map(Main::testNullableStaticMethod)
|
|
.map(Main::requireNonNull);
|
|
}
|
|
|
|
static <T> T requireNonNull(T obj) {
|
|
if (obj == null) {
|
|
throw new NullPointerException();
|
|
}
|
|
return obj;
|
|
}
|
|
|
|
@Nullable
|
|
public static native String testNullableStaticMethod(String something);
|
|
} |