private @Nullable CompilerElementInfo asCompilerElements(@NotNull PsiElement psiElement,
                                                           boolean buildHierarchyForLibraryElements,
                                                           boolean checkNotDirty) {
    if (!myReadDataLock.tryLock()) {
      return null;
    }
    try {
      if (myReader == null) {
        return null;
      }
      VirtualFile file = PsiUtilCore.getVirtualFile(psiElement);
      if (file == null) {
        return null;
      }
      ElementPlace place = ElementPlace.get(file, myProjectFileIndex);
      if (checkNotDirty) {
        if (place == null || (place == ElementPlace.SRC && myDirtyScopeHolder.contains(file))) {
          return null;
        }
      }
      final LanguageCompilerRefAdapter adapter = LanguageCompilerRefAdapter.findAdapter(psiElement, true);
      if (adapter == null) {
        return null;
      }
      final List<CompilerRef> refs = adapter.asCompilerRefs(psiElement, myReader.getNameEnumerator());
      if (refs == null) {
        return null;
      }
      if (place == ElementPlace.LIB && buildHierarchyForLibraryElements) {
        if (adapter.isTooCommonLibraryElement(psiElement)) return null;

        return computeInLibraryScope(() -> {
          GlobalSearchScope librariesScope = ProjectScope.getLibrariesScope(project);
          List<CompilerRef> resultList = new ArrayList<>(refs);
          for (CompilerRef ref : refs) {
            resultList.addAll(adapter.getHierarchyRestrictedToLibraryScope(ref, psiElement, myReader.getNameEnumerator(), librariesScope));
          }
          return new CompilerElementInfo(place, resultList);
        });
      }
      else {
        return new CompilerElementInfo(place, refs);
      }
    }
    catch (IOException e) {
      throw new RuntimeException(e);
    }
    finally {
      myReadDataLock.unlock();
    }
  }
private @Nullable CompilerElementInfo asCompilerElements(@NotNull PsiElement psiElement,
                                                           boolean buildHierarchyForLibraryElements,
                                                           boolean checkNotDirty)