private static boolean addElementUsages(@NotNull PsiElement element,
                                          @NotNull FindUsagesOptions options,
                                          @NotNull Processor<? super UsageInfo> processor) {
    SearchScope searchScope = options.searchScope;
    PsiClass[] parentClass = new PsiClass[1];
    if (element instanceof PsiMethod psiMethod && ReadAction.compute(() -> {
      PsiMethod method = (PsiMethod)element;
      parentClass[0] = method.getContainingClass();
      return method.isConstructor();
    })) {
      if (parentClass[0] != null) {
        boolean strictSignatureSearch =
          !(options instanceof JavaMethodFindUsagesOptions javaOptions) || !javaOptions.isIncludeOverloadUsages;
        return MethodReferencesSearch
          .search(new MethodReferencesSearch.SearchParameters(psiMethod, searchScope, strictSignatureSearch, options.fastTrack))
          .forEach(new ReadActionProcessor<>() {
            @Override
            public boolean processInReadAction(PsiReference ref) {
              return addResult(ref, options, processor);
            }
          });
      }
      return true;
    }

    ReadActionProcessor<PsiReference> consumer = new ReadActionProcessor<>() {
      @Override
      public boolean processInReadAction(PsiReference ref) {
        return addResult(ref, options, processor);
      }
    };

    if (element instanceof PsiMethod psiMethod) {
      boolean strictSignatureSearch = !(options instanceof JavaMethodFindUsagesOptions javaOptions) || // field with getter
                                      !javaOptions.isIncludeOverloadUsages;
      return MethodReferencesSearch
        .search(new MethodReferencesSearch.SearchParameters(psiMethod, searchScope, strictSignatureSearch, options.fastTrack))
        .forEach(consumer);
    }
    return ReferencesSearch.search(new ReferencesSearch.SearchParameters(element, searchScope, false, options.fastTrack)).forEach(consumer);
  }
private static boolean addElementUsages(@NotNull PsiElement element,
                                          @NotNull FindUsagesOptions options,
                                          @NotNull Processor<? super UsageInfo> processor)