void (@NotNull Collection<? extends VirtualFile> files, @NotNull Consumer<? super Boolean> errorsFoundConsumer) { ApplicationManager.getApplication().executeOnPooledThread(() -> { final boolean errorsFound = ReadAction.compute(() -> { for (VirtualFile file : files) { if (PsiErrorElementUtil.hasErrors(myProject, file)) { return true; } } return false; }); ApplicationManager.getApplication().invokeLater(() -> errorsFoundConsumer.accept(errorsFound), ModalityState.any()); }); }