@Nullable
  public static PsiType getCastableRuntimeType(Project project, Value value) {
    Type type = value.type();
    PsiType psiType = findPsiType(project, type);
    if (psiType != null) {
      return psiType;
    }

    if (type instanceof ClassType) {
      ClassType superclass = ((ClassType)type).superclass();
      if (superclass != null && !CommonClassNames.JAVA_LANG_OBJECT.equals(superclass.name())) {
        psiType = findPsiType(project, superclass);
        if (psiType != null) {
          return psiType;
        }
      }

      for (InterfaceType interfaceType : ((ClassType)type).interfaces()) {
        psiType = findPsiType(project, interfaceType);
        if (psiType != null) {
          return psiType;
        }
      }
    }
    return null;
  }
@Nullable
  public static PsiType getCastableRuntimeType(Project project, Value value)