[java-dfa] NotNull annotations

GitOrigin-RevId: 18ff1d129199bf3a85b79aafd1aa4c620fc67f7f
This commit is contained in:
Tagir Valeev
2024-03-04 17:20:06 +01:00
committed by intellij-monorepo-bot
parent 82fd757f9d
commit 7be47b61b0
2 changed files with 8 additions and 5 deletions

View File

@@ -21,7 +21,10 @@ import org.jetbrains.annotations.Nls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.*;
import java.util.Collections;
import java.util.HashSet;
import java.util.Objects;
import java.util.Set;
import static com.intellij.codeInspection.dataFlow.TypeConstraints.*;
@@ -154,7 +157,7 @@ public sealed interface TypeConstraint permits TypeConstraint.Constrained, TypeC
/**
* @return a {@link DfType} that represents any object that satisfies this constraint, or null (nullability is unknown)
*/
default DfType asDfType() {
default @NotNull DfType asDfType() {
return this == BOTTOM ? DfType.BOTTOM :
DfTypes.customObject(this, DfaNullability.UNKNOWN, Mutability.UNKNOWN, null, DfType.BOTTOM);
}

View File

@@ -26,16 +26,16 @@ public final class TypeConstraints {
/**
* Top constraint (no restriction; any non-primitive value satisfies this)
*/
public static final TypeConstraint TOP = new TopConstraint();
public static final @NotNull TypeConstraint TOP = new TopConstraint();
/**
* Bottom constraint (no actual type satisfies this)
*/
public static final TypeConstraint BOTTOM = new BottomConstraint();
public static final @NotNull TypeConstraint BOTTOM = new BottomConstraint();
/**
* Exactly java.lang.Object class
*/
public static final Exact EXACTLY_OBJECT = new ExactObject();
public static final @NotNull Exact EXACTLY_OBJECT = new ExactObject();
@Nullable
private static Exact createExact(@NotNull PsiType type) {