void (@NotNull ActionContext context, @NotNull PsiExpression startElement, @NotNull ModPsiUpdater updater) { List<PsiAnnotationMemberValue> values = ContainerUtil.map(myMemberValuePointers, SmartPsiElementPointer::getElement); String text = StringUtil.join(Collections.nCopies(values.size(), "0"), " | "); PsiExpression concatExp = PsiElementFactory.getInstance(context.project()).createExpressionFromText(text, startElement); List<PsiLiteralExpression> expressionsToReplace = new ArrayList<>(values.size()); concatExp.accept(new JavaRecursiveElementWalkingVisitor() { @Override public void visitLiteralExpression(@NotNull PsiLiteralExpression expression) { super.visitLiteralExpression(expression); if (Integer.valueOf(0).equals(expression.getValue())) { expressionsToReplace.add(expression); } } }); Iterator<PsiAnnotationMemberValue> iterator = values.iterator(); List<PsiElement> resolved = new ArrayList<>(); for (PsiLiteralExpression toReplace : expressionsToReplace) { PsiAnnotationMemberValue value = iterator.next(); resolved.add(((PsiReference)value).resolve()); PsiExpression replaced = (PsiExpression)toReplace.replace(value); if (toReplace == concatExp) { concatExp = replaced; } } PsiElement newStartElement = startElement.replace(concatExp); Iterator<PsiElement> resolvedValuesIterator = resolved.iterator(); newStartElement.accept(new JavaRecursiveElementWalkingVisitor() { @Override public void visitReferenceExpression(@NotNull PsiReferenceExpression expression) { PsiElement bound = expression.bindToElement(resolvedValuesIterator.next()); JavaCodeStyleManager.getInstance(context.project()).shortenClassReferences(bound); } }); }