void (PsiElement elementToBind, String newQName, UsageInfo[] usages, ArrayList<? super SmartPsiElementPointer<PsiElement>> refsToShorten) { try { SmartPointerManager smartPointerManager = SmartPointerManager.getInstance(elementToBind.getProject()); // rename all references for (UsageInfo usage : usages) { if (usage instanceof MigrationProcessor.MigrationUsageInfo usageInfo && Objects.equals(newQName, usageInfo.mapEntry.getNewName())) { PsiElement element = usage.getElement(); if (element == null || !element.isValid()) continue; UElement uElement = UastContextKt.toUElement(element); PsiElement psiElement; if (uElement instanceof UReferenceExpression) { psiElement = UastCodeGenerationPluginKt.bindToElement((UReferenceExpression)uElement, elementToBind); } else { psiElement = bindNonJavaReference(elementToBind, element, usage); } if (psiElement != null) { refsToShorten.add(smartPointerManager.createSmartPsiElementPointer(psiElement)); } } } } catch (IncorrectOperationException e) { // should not happen! LOG.error(e); } }