boolean (@NotNull PsiFile file, boolean updateWholeFile, @NotNull HighlightInfoHolder holder, @NotNull Runnable action) { myDumb = myDumbService.isDumb(); myHolder = holder; myAnnotationHolder = new AnnotationHolderImpl(holder.getAnnotationSession(), myBatchMode) { @Override void queueToUpdateIncrementally() { if (!isEmpty()) { myAnnotatorStatisticsCollector.reportAnnotationProduced(myCurrentAnnotator, get(0)); for (int i = 0; i < size(); i++) { Annotation annotation = get(i); holder.add(HighlightInfo.fromAnnotation(myCurrentAnnotator.getClass(), annotation, myBatchMode)); } clear(); } } }; try { action.run(); myAnnotationHolder.assertAllAnnotationsCreated(); } finally { myAnnotators.clear(); myHolder = null; myAnnotationHolder = null; myAnnotatorStatisticsCollector.reportAnalysisFinished(myProject, holder.getAnnotationSession(), file); } return true; }