void (@NotNull PsiReference ref, PsiElement refElement) { PsiElement element = ref.getElement(); if (refElement instanceof PsiMethod && PsiTreeUtil.isAncestor(refElement, element, true)) return; // filter self-recursive calls if (refElement instanceof PsiClass) { if (PsiTreeUtil.isAncestor(refElement, element, true)) { return; // filter inner use of itself } } myLocalRefsMap.putValue(refElement, ref); }