boolean (@NotNull PsiReference reference, @NotNull JavaCallHierarchyData data) { PsiClass originalClass = data.getOriginalClass(); PsiMethod method = data.getMethod(); Set<? extends PsiMethod> methodsToFind = data.getMethodsToFind(); PsiMethod methodToFind = data.getMethodToFind(); PsiClassType originalType = data.getOriginalType(); Map<PsiMember, NodeDescriptor<?>> methodToDescriptorMap = data.getResultMap(); Project project = data.getProject(); if (reference instanceof GrReferenceExpression) { GrExpression qualifier = ((GrReferenceExpression)reference).getQualifierExpression(); if (org.jetbrains.plugins.groovy.lang.psi.util.PsiUtil.isSuperReference(qualifier)) { // filter super.foo() call inside foo() and similar cases (bug 8411) PsiClass superClass = PsiUtil.resolveClassInType(qualifier.getType()); if (superClass == null || originalClass.isInheritor(superClass, true)) { return false; } } if (qualifier != null && !methodToFind.hasModifierProperty(PsiModifier.STATIC)) { PsiType qualifierType = qualifier.getType(); if (qualifierType instanceof PsiClassType && !TypeConversionUtil.isAssignable(qualifierType, originalType) && methodToFind != method) { PsiClass psiClass = ((PsiClassType)qualifierType).resolve(); if (psiClass != null) { PsiMethod callee = psiClass.findMethodBySignature(methodToFind, true); if (callee != null && !methodsToFind.contains(callee)) { // skip sibling methods return false; } } } } } else { if (!(reference instanceof PsiElement)) { return true; } PsiElement parent = ((PsiElement)reference).getParent(); if (parent instanceof PsiNewExpression) { if (((PsiNewExpression)parent).getClassReference() != reference) { return true; } } else if (parent instanceof GrAnonymousClassDefinition) { if (((GrAnonymousClassDefinition)parent).getBaseClassReferenceGroovy() != reference) { return true; } } else { return true; } } PsiElement element = reference.getElement(); PsiMember key = CallHierarchyNodeDescriptor.getEnclosingElement(element); synchronized (methodToDescriptorMap) { CallHierarchyNodeDescriptor d = (CallHierarchyNodeDescriptor)methodToDescriptorMap.get(key); if (d == null) { d = new CallHierarchyNodeDescriptor(project, (CallHierarchyNodeDescriptor)data.getNodeDescriptor(), element, false, true); methodToDescriptorMap.put(key, d); } else if (!d.hasReference(reference)) { d.incrementUsageCount(); } d.addReference(reference); } return true; }