private static void killAbandonedHighlightsUnder(@NotNull Project project,
                                                   @NotNull Document document,
                                                   long range,
                                                   @Nullable List<? extends HighlightInfo> infos,
                                                   @NotNull HighlightingSession session) {
    List<RangeHighlighterEx> toRemove = new ArrayList<>();
    DaemonCodeAnalyzerEx.processHighlights(document, project, null, TextRangeScalarUtil.startOffset(range), TextRangeScalarUtil.endOffset(range), existing -> {
      if (existing.getGroup() == Pass.UPDATE_ALL && !existing.isFromAnnotator() && TextRangeScalarUtil.startOffset(range) == existing.getVisitingTextRange().getStartOffset() && TextRangeScalarUtil.endOffset(range) == existing.getVisitingTextRange().getEndOffset()) {
        if (infos != null) {
          for (HighlightInfo created : infos) {
            if (existing.equalsByActualOffset(created)) return true;
          }
        }
        RangeHighlighterEx highlighter = existing.getHighlighter();
        if (highlighter != null && UpdateHighlightersUtil.shouldRemoveHighlighter(highlighter, session)) {
          // it seems that highlight info 'existing' is going to disappear; remove it earlier
          toRemove.add(highlighter);
        }
      }
      return true;
    });
    for (RangeHighlighterEx highlighter : toRemove) {
      highlighter.dispose();
    }
  }
private static void killAbandonedHighlightsUnder(@NotNull Project project,
                                                   @NotNull Document document,
                                                   long range,
                                                   @Nullable List<? extends HighlightInfo> infos,
                                                   @NotNull HighlightingSession session)