void (PsiElement namedElement, Collection<? super PsiElement> elementsToInvert) { final Query<PsiReference> query = namedElement instanceof PsiMethod ? MethodReferencesSearch.search((PsiMethod)namedElement) : ReferencesSearch.search(namedElement); final Collection<PsiReference> refs = query.findAll(); for (PsiReference ref : refs) { final PsiElement element = ref.getElement(); if (!collectElementsToInvert(namedElement, element, elementsToInvert)) { collectForeignElementsToInvert(namedElement, element, JavaLanguage.INSTANCE, elementsToInvert); } } }