mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[java-analysis] IDEA-375470 Type parameter with nullable bound within NullMarked scope should be nullable
GitOrigin-RevId: c8c264ab40180c7982ac8d5d886841323578348b
This commit is contained in:
committed by
intellij-monorepo-bot
parent
6c7bdfdace
commit
0cb6e48c04
@@ -115,6 +115,10 @@ public final class TypeNullability {
|
||||
}
|
||||
|
||||
public static @NotNull TypeNullability ofTypeParameter(@NotNull PsiTypeParameter parameter) {
|
||||
TypeNullability nullability = intersect(ContainerUtil.map(parameter.getSuperTypes(), PsiType::getNullability)).inherited();
|
||||
if (!nullability.equals(UNKNOWN)) {
|
||||
return nullability;
|
||||
}
|
||||
NullableNotNullManager manager = NullableNotNullManager.getInstance(parameter.getProject());
|
||||
if (manager != null) {
|
||||
NullabilityAnnotationInfo typeUseNullability = manager.findDefaultTypeUseNullability(parameter);
|
||||
@@ -122,7 +126,7 @@ public final class TypeNullability {
|
||||
return typeUseNullability.toTypeNullability();
|
||||
}
|
||||
}
|
||||
return intersect(ContainerUtil.map(parameter.getSuperTypes(), PsiType::getNullability)).inherited();
|
||||
return UNKNOWN;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
import org.jspecify.annotations.*;
|
||||
|
||||
@NullMarked
|
||||
class Test2 {
|
||||
void call(Test<? extends Base, ? extends @Nullable Base> a) {}
|
||||
|
||||
}
|
||||
class Base {}
|
||||
|
||||
@NullMarked
|
||||
class Test<T, E extends @Nullable Object> {}
|
||||
+6
@@ -483,4 +483,10 @@ public class NullableStuffInspectionTest extends LightJavaCodeInsightFixtureTest
|
||||
setupTypeUseAnnotations("org.jspecify.annotations", myFixture);
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testNullableExtendsNullable() {
|
||||
addJSpecifyNullMarked(myFixture);
|
||||
setupTypeUseAnnotations("org.jspecify.annotations", myFixture);
|
||||
doTest();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user