ModCommand (@NotNull ActionContext context) { Project project = context.project(); PsiElement element = context.findLeaf(); final PsiElementFactory elementFactory = JavaPsiFacade.getElementFactory(project); final PsiExpression expression = getExpression(element); assert expression != null; final PsiExpression toReplace = elementFactory.createExpressionFromText(getArrayCreation(expression, boxing), element); return ModCommand.psiUpdate(expression, e -> JavaCodeStyleManager.getInstance(project).shortenClassReferences(e.replace(toReplace))); }