public static <Init,Result> ProblemDescriptor @NotNull [] checkFileWithExternalAnnotator(@NotNull PsiFile file,
                                                                                           @NotNull InspectionManager manager,
                                                                                           boolean isOnTheFly,
                                                                                           @NotNull ExternalAnnotator<Init, Result> annotator) {
    if (isOnTheFly) {
      // ExternalAnnotator does this work
      return ProblemDescriptor.EMPTY_ARRAY;
    }

    Init info = ReadAction.compute(() -> annotator.collectInformation(file));
    if (info != null) {
      Result annotationResult = annotator.doAnnotate(info);
      if (annotationResult == null) {
        return ProblemDescriptor.EMPTY_ARRAY;
      }
      return ReadAction.compute(() -> AnnotationSessionImpl.computeWithSession(file, true, annotator, annotationHolder -> {
        ((AnnotationHolderImpl)annotationHolder).applyExternalAnnotatorWithContext(file, annotationResult);
        ((AnnotationHolderImpl)annotationHolder).assertAllAnnotationsCreated();
        return ProblemDescriptorUtil.convertToProblemDescriptors((List<? extends Annotation>)annotationHolder, file);
      }));
    }
    return ProblemDescriptor.EMPTY_ARRAY;
  }
public static <Init,Result> ProblemDescriptor @NotNull [] checkFileWithExternalAnnotator(@NotNull PsiFile file,
                                                                                           @NotNull InspectionManager manager,
                                                                                           boolean isOnTheFly,
                                                                                           @NotNull ExternalAnnotator<Init, Result> annotator)