boolean processConstructorReferences(@NotNull final Processor<? super PsiReference> processor,
                                       @NotNull final PsiMethod constructor,
                                       @NotNull final PsiClass containingClass,
                                       @NotNull final SearchScope searchScope,
                                       @NotNull final Project project,
                                       boolean ignoreAccessScope,
                                       final boolean isStrictSignatureSearch,
                                       @NotNull SearchRequestCollector collector) {
    final boolean[] constructorCanBeCalledImplicitly = new boolean[1];
    final boolean[] isEnum = new boolean[1];
    final boolean[] isUnder18 = new boolean[1];

    DumbService.getInstance(project).runReadActionInSmartMode(() -> {
      final PsiParameter[] parameters = constructor.getParameterList().getParameters();
      constructorCanBeCalledImplicitly[0] = parameters.length == 0;
      if (!constructorCanBeCalledImplicitly[0]) {
        constructorCanBeCalledImplicitly[0] = parameters.length == 1 && parameters[0].isVarArgs();
      }
      isEnum[0] = containingClass.isEnum();
      isUnder18[0] = PsiUtil.getLanguageLevel(containingClass).isAtLeast(LanguageLevel.JDK_1_8);
      return null;
    });

    if (isEnum[0]) {
      if (!processEnumReferences(processor, constructor, project, containingClass)) return false;
    }

    // search usages like "new XXX(..)"
    PairProcessor<PsiReference, SearchRequestCollector> processor1 = (reference, collector1) -> {
      PsiElement parent = reference.getElement().getParent();
      if (parent instanceof PsiAnonymousClass) {
        parent = parent.getParent();
      }
      if (parent instanceof PsiNewExpression) {
        PsiMethod constructor1 = ((PsiNewExpression)parent).resolveConstructor();
        if (constructor1 != null) {
          if (isStrictSignatureSearch) {
            if (myManager.areElementsEquivalent(constructor, constructor1)) {
              return processor.process(reference);
            }
          }
          else {
            if (myManager.areElementsEquivalent(containingClass, constructor1.getContainingClass())) {
              return processor.process(reference);
            }
          }
        }
      }
      return true;
    };

    SearchScope restrictedScope = searchScope instanceof GlobalSearchScope
                                  ? ((GlobalSearchScope)searchScope).intersectWith(new JavaFilesSearchScope(project))
                                  : searchScope;

    ReferencesSearch.searchOptimized(containingClass, restrictedScope, ignoreAccessScope, collector, true, processor1);
    if (isUnder18[0]) {
      if (!process18MethodPointers(processor, constructor, project, containingClass, restrictedScope)) return false;
    }

    // search usages like "this(..)"
    if (!DumbService.getInstance(project).runReadActionInSmartMode(
      () -> processSuperOrThis(containingClass, constructor, constructorCanBeCalledImplicitly[0], searchScope, project,
                               isStrictSignatureSearch,
                               PsiKeyword.THIS, PsiKeyword.SUPER, processor))) {
      return false;
    }

    // search usages like "super(..)"
    Processor<PsiClass> processor2 = inheritor -> {
      final PsiElement navigationElement = inheritor.getNavigationElement();
      if (navigationElement instanceof PsiClass) {
        return processSuperOrThis((PsiClass)navigationElement, constructor, constructorCanBeCalledImplicitly[0], searchScope, project,
                                  isStrictSignatureSearch, PsiKeyword.SUPER, PsiKeyword.THIS, processor);
      }
      return true;
    };

    return ClassInheritorsSearch.search(containingClass, searchScope, false).allowParallelProcessing().forEach(processor2);
  }
boolean processConstructorReferences(@NotNull final Processor<? super PsiReference> processor,
                                       @NotNull final PsiMethod constructor,
                                       @NotNull final PsiClass containingClass,
                                       @NotNull final SearchScope searchScope,
                                       @NotNull final Project project,
                                       boolean ignoreAccessScope,
                                       final boolean isStrictSignatureSearch,
                                       @NotNull SearchRequestCollector collector)