public static boolean hasErrors(@NotNull Project project, @NotNull VirtualFile virtualFile) {
    return ReadAction.compute(() -> {
      if (project.isDisposed() || !virtualFile.isValid()) return false;
      PsiFile psiFile = PsiManager.getInstance(project).findFile(virtualFile);
      return psiFile != null && hasErrors(psiFile);
    });
  }
public static boolean hasErrors(@NotNull Project project, @NotNull VirtualFile virtualFile)