public static @NotNull DfConstantType<?> constant(@Nullable Object constant, @NotNull DfType type) {
    if (constant == null) return NULL;
    DfConstantType<?> primitiveConstant = primitiveConstantImpl(constant);
    if (primitiveConstant != null) return primitiveConstant;
    if (!(type instanceof DfReferenceType)) {
      throw new IllegalArgumentException("Not reference type: " + type + "; constant: " + constant);
    }
    return new DfReferenceConstantType(constant, ((DfReferenceType)type).getConstraint(), false);
  }
public static @NotNull DfConstantType<?> constant(@Nullable Object constant, @NotNull DfType type)