private static @NotNull PsiType fixUnresolvedType(@NotNull PsiElement context, @NotNull PsiType type) {
    if (type instanceof PsiClassType && ((PsiClassType)type).resolve() == null) {
      String className = ((PsiClassType)type).getClassName();
      int typeParamCount = ((PsiClassType)type).getParameterCount();
      Project project = context.getProject();
      PsiResolveHelper helper = PsiResolveHelper.getInstance(project);
      List<PsiClass> suitableClasses = ContainerUtil.filter(
        PsiShortNamesCache.getInstance(project).getClassesByName(className, context.getResolveScope()),
        c -> (typeParamCount == 0 || c.hasTypeParameters()) &&
             helper.isAccessible(c, context, null) &&
             ImportClassFixBase.qualifiedNameAllowsAutoImport(context.getContainingFile(), c));
      if (suitableClasses.size() == 1) {
        return PsiElementFactory.getInstance(project).createType(suitableClasses.get(0), ((PsiClassType)type).getParameters());
      }
    }
    return type;
  }
private static @NotNull PsiType fixUnresolvedType(@NotNull PsiElement context, @NotNull PsiType type)