mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[java-dfa] Support JSR-305 unknown nullability
Fixes IDEA-278618 JSR-305 @Nonnull(when = UNKNOWN) not handled correctly GitOrigin-RevId: 5983fbdcaad42dd5db8e1c8adb27cedbb9a746e2
This commit is contained in:
committed by
intellij-monorepo-bot
parent
9d6899a508
commit
86d0145b26
@@ -237,7 +237,7 @@ public abstract class NullableNotNullManager {
|
||||
}
|
||||
};
|
||||
NullabilityAnnotationInfo result = findPlainAnnotation(owner, false, false, filtered);
|
||||
return result == null ? null : result.getAnnotation();
|
||||
return result == null || !nullabilities.contains(result.getNullability()) ? null : result.getAnnotation();
|
||||
}
|
||||
|
||||
private @Nullable NullabilityAnnotationInfo findPlainAnnotation(
|
||||
@@ -260,6 +260,7 @@ public abstract class NullableNotNullManager {
|
||||
if (memberAnno != null) {
|
||||
Nullability nullability = annotations.getNullability(memberAnno.annotation.getQualifiedName());
|
||||
if (nullability == null) return null;
|
||||
nullability = correctNullability(nullability, memberAnno.annotation);
|
||||
if (type != null) {
|
||||
for (PsiAnnotation typeAnno : type.getApplicableAnnotations()) {
|
||||
if (typeAnno == memberAnno.annotation) continue;
|
||||
@@ -279,6 +280,10 @@ public abstract class NullableNotNullManager {
|
||||
return findAnnotationInTypeHierarchy(type, annotations);
|
||||
}
|
||||
|
||||
protected @NotNull Nullability correctNullability(@NotNull Nullability nullability, @NotNull PsiAnnotation annotation) {
|
||||
return nullability;
|
||||
}
|
||||
|
||||
private static boolean areDifferentNullityAnnotations(@NotNull PsiAnnotation memberAnno, @NotNull PsiAnnotation typeAnno) {
|
||||
NullableNotNullManager manager = getInstance(memberAnno.getProject());
|
||||
List<String> notNulls = manager.getNotNullsWithNickNames();
|
||||
@@ -437,6 +442,7 @@ public abstract class NullableNotNullManager {
|
||||
if (qualifiedNames.qualifiedNames().contains(qualifiedName)) {
|
||||
Nullability nullability = qualifiedNames.getNullability(qualifiedName);
|
||||
if (nullability != null) {
|
||||
nullability = correctNullability(nullability, annotation);
|
||||
result.set(new NullabilityAnnotationInfo(annotation, nullability, false));
|
||||
}
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user