DfType (@Nullable PsiType type, @NotNull Nullability nullability) { if (type == null) return DfType.TOP; if (type instanceof PsiPrimitiveType) { if (type.equals(PsiTypes.voidType())) return DfType.BOTTOM; if (type.equals(PsiTypes.booleanType())) return BOOLEAN; if (type.equals(PsiTypes.intType())) return INT; if (type.equals(PsiTypes.charType()) || type.equals(PsiTypes.shortType()) || type.equals(PsiTypes.byteType())){ return intRange(Objects.requireNonNull(JvmPsiRangeSetUtil.typeRange(type))); } if (type.equals(PsiTypes.longType())) return LONG; if (type.equals(PsiTypes.doubleType())) return DOUBLE; if (type.equals(PsiTypes.floatType())) return FLOAT; if (type.equals(PsiTypes.nullType())) return NULL; } TypeConstraint constraint = TypeConstraints.instanceOf(type); if (constraint == TypeConstraints.BOTTOM) { return nullability == Nullability.NOT_NULL ? DfType.BOTTOM : NULL; } if (constraint.isSingleton() && nullability == Nullability.NOT_NULL) { return new DfReferenceConstantType(constraint, constraint, false); } return new DfGenericObjectType(Set.of(), constraint, DfaNullability.fromNullability(nullability), Mutability.UNKNOWN, null, DfType.BOTTOM, false); }