void (final PsiMethod constructor, final SearchScope searchScope, final Processor<? super PsiReference> consumer, final SearchRequestCollector collector, final boolean includeOverloads) { if (!constructor.isConstructor()) return; final PsiClass clazz = constructor.getContainingClass(); if (clazz == null) return; SearchScope onlyGroovy = GroovyScopeUtil.restrictScopeToGroovyFiles(searchScope, GroovyScopeUtil.getEffectiveScope(constructor)); Set<PsiClass> processed = collector.getSearchSession().getUserData(LITERALLY_CONSTRUCTED_CLASSES); if (processed == null) { collector.getSearchSession().putUserData(LITERALLY_CONSTRUCTED_CLASSES, processed = ConcurrentCollectionFactory.createConcurrentSet()); } if (!processed.add(clazz)) return; if (clazz.isEnum() && clazz instanceof GroovyPsiElement) { for (PsiField field : clazz.getFields()) { if (field instanceof GrEnumConstant) { final PsiReference ref = field.getReference(); if (ref != null && ref.isReferenceTo(constructor)) { if (!consumer.process(ref)) return; } } } } final LiteralConstructorSearcher literalProcessor = new LiteralConstructorSearcher(constructor, consumer, includeOverloads); final Processor<GrNewExpression> newExpressionProcessor = grNewExpression -> { final PsiMethod resolvedConstructor = grNewExpression.resolveMethod(); if (includeOverloads || constructor.getManager().areElementsEquivalent(resolvedConstructor, constructor)) { return consumer.process(grNewExpression.getReferenceElement()); } return true; }; processGroovyClassUsages(clazz, onlyGroovy, collector, newExpressionProcessor, literalProcessor); //this() if (clazz instanceof GrTypeDefinition) { if (!processConstructors(constructor, consumer, clazz, true)) { return; } } //super() DirectClassInheritorsSearch.search(clazz, onlyGroovy).forEach(new ReadActionProcessor<>() { @Override public boolean processInReadAction(PsiClass inheritor) { if (inheritor instanceof GrTypeDefinition) { if (!processConstructors(constructor, consumer, inheritor, false)) return false; } return true; } }); }