synchronized void removeInvalidPsiElements(@NotNull PsiFile psiFile,
                                             @NotNull Object requestor,
                                             @NotNull HighlightingSession session) {
    InjectedLanguageManager injectedLanguageManager = InjectedLanguageManager.getInstance(psiFile.getProject());
    PsiFile hostFile = injectedLanguageManager.getTopLevelFile(psiFile);
    Document hostDocument = hostFile.getFileDocument();
    Map<PsiFile, Map<Object, ToolHighlights>> hostMap = getOrCreateHostMap(hostDocument);
    List<Map<Object, ToolHighlights>> myMaps = new ArrayList<>();
    PsiDocumentManager documentManager = PsiDocumentManager.getInstance(hostFile.getProject());
    hostMap.entrySet().removeIf(entry -> {
      PsiFile psi = entry.getKey();
      Map<Object, ToolHighlights> toolMap = entry.getValue();
      if (psi.isValid()) {
        Document document = documentManager.getDocument(psi);
        Document topLevelDocument = document instanceof DocumentWindow ? ((DocumentWindow)document).getDelegate() : document;
        if (topLevelDocument == hostDocument) {
          myMaps.add(toolMap);
        }
        return false;
      }
      if (psi == psiFile) {
        return false;
      }
      removeAllHighlighterInsideFile(psi, requestor, session, toolMap);
      return true;
    });
    for (Map<Object, ToolHighlights> map : myMaps) {
      if (map.isEmpty()) {
        continue;
      }
      for (Map.Entry<Object, ToolHighlights> toolEntry : map.entrySet()) {
        ToolHighlights toolHighlights = toolEntry.getValue();
        invokeProcessQueueToTriggerEvictedListener(toolHighlights.elementHighlights);
        Iterator<Map.Entry<PsiElement, List<? extends HighlightInfo>>> iterator = toolHighlights.elementHighlights.entrySet().iterator();
        while (iterator.hasNext()) {
          Map.Entry<PsiElement, List<? extends HighlightInfo>> entry = iterator.next();
          PsiElement element = entry.getKey();
          ProgressManager.checkCanceled();
          if (element == PsiUtilCore.NULL_PSI_ELEMENT/*evicted*/ || element != FAKE_ELEMENT && !element.isValid()) {
            List<? extends HighlightInfo> infos = entry.getValue();
            for (HighlightInfo info : infos) {
              RangeHighlighterEx highlighter = info.getHighlighter();
              if (highlighter != null) {
                if (LOG.isDebugEnabled()) {
                  LOG.debug("removeInvalidPsiElements: " + highlighter+" for invalid " + element + " from " + requestor);
                }
                UpdateHighlightersUtil.disposeWithFileLevelIgnoreErrors(highlighter, info, session);
              }
            }
            iterator.remove();
          }
        }
      }
    }
  }
synchronized void removeInvalidPsiElements(@NotNull PsiFile psiFile,
                                             @NotNull Object requestor,
                                             @NotNull HighlightingSession session)