mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-16 22:51:17 +07:00
IDEA-228079 Bad code green when dereferencing an unannotated parameter with nullable super
GitOrigin-RevId: ff3b4f3c7c01c2fb5aa90107037517653cadafa2
This commit is contained in:
committed by
intellij-monorepo-bot
parent
680f4703db
commit
3a7ab57eb2
@@ -128,10 +128,13 @@ public class DfaPsiUtil {
|
||||
private static Nullability getNullabilityFromAnnotation(PsiModifierListOwner owner, boolean ignoreParameterNullabilityInference) {
|
||||
NullableNotNullManager manager = NullableNotNullManager.getInstance(owner.getProject());
|
||||
NullabilityAnnotationInfo info = manager.findEffectiveNullabilityInfo(owner);
|
||||
if (info == null ||
|
||||
ignoreParameterNullabilityInference && owner instanceof PsiParameter && AnnotationUtil.isInferredAnnotation(info.getAnnotation())) {
|
||||
if (info == null) {
|
||||
return Nullability.UNKNOWN;
|
||||
}
|
||||
if (ignoreParameterNullabilityInference && owner instanceof PsiParameter && AnnotationUtil.isInferredAnnotation(info.getAnnotation())) {
|
||||
List<PsiParameter> supers = AnnotationUtil.getSuperAnnotationOwners((PsiParameter)owner);
|
||||
return ContainerUtil.exists(supers, each -> manager.isNullable(each, false)) ? Nullability.NULLABLE : Nullability.UNKNOWN;
|
||||
}
|
||||
return info.getNullability();
|
||||
}
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@ public interface VariableDescriptor {
|
||||
}
|
||||
PsiType type = getType(null);
|
||||
LongRangeSet range = LongRangeSet.fromPsiElement(getPsiElement());
|
||||
DfType dfType = DfTypes.typedObject(type, DfaPsiUtil.getElementNullability(type, getPsiElement()));
|
||||
DfType dfType = DfTypes.typedObject(type, DfaPsiUtil.getElementNullabilityIgnoringParameterInference(type, getPsiElement()));
|
||||
if (dfType instanceof DfIntegralType) {
|
||||
dfType = ((DfIntegralType)dfType).meetRange(range);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user