HashSet<PsiMethod> (PsiMethod method) { final HashSet<PsiMethod> methodsToPropagate = new HashSet<>(); final PsiReference[] references = MethodReferencesSearch.search(method, GlobalSearchScope.allScope(getProject()), true).toArray(PsiReference.EMPTY_ARRAY); for (PsiReference reference : references) { final PsiElement element = reference.getElement(); Assert.assertTrue(element instanceof PsiClass); PsiClass containingClass = (PsiClass)element; methodsToPropagate.add(JavaPsiFacade.getElementFactory(getProject()).createMethodFromText(containingClass.getName() + "(){}", containingClass)); } return methodsToPropagate; }