void (@NotNull PsiReferenceList source, @Nullable PsiReferenceList target, @NotNull PsiClass oldClass) { final PsiJavaCodeReferenceElement[] sourceReferences = source.getReferenceElements(); for (final PsiJavaCodeReferenceElement sourceReference : sourceReferences) { if (sourceReference.isReferenceTo(oldClass)) { if (target != null) { target.add(sourceReference); } sourceReference.delete(); } } }