void (SearchScope searchScope, final String name, @NotNull PsiMethod searchTarget, @NotNull SearchRequestCollector collector, final int paramCount) { if (StringUtil.isEmpty(name)) return; collector.searchWord(name, searchScope, UsageSearchContext.IN_CODE, true, searchTarget, new RequestResultProcessor("groovy.lateBound") { @Override public boolean processTextOccurrence(@NotNull PsiElement element, int offsetInElement, @NotNull Processor<? super PsiReference> consumer) { if (!(element instanceof GrReferenceExpression ref)) { return true; } if (!name.equals(ref.getReferenceName()) || PsiUtil.isLValue(ref)) { return true; } PsiElement parent = ref.getParent(); if (parent instanceof GrCommandArgumentList) { parent = parent.getParent(); } if (paramCount >= 0 && !ref.hasMemberPointer() && (!(parent instanceof GrMethodCall) || !argumentsMatch((GrMethodCall)parent, paramCount))) { return true; } GrExpression qualifier = ref.getQualifierExpression(); if (qualifier == null || qualifier.getType() != null) { return true; } if (ref.resolve() != null) { return true; } if (ResolveUtil.isKeyOfMap(ref)) { return true; } return consumer.process((PsiReference)element); } }); }