public static void replaceExpression(@NotNull String newExpression, @NotNull PsiExpression exp) throws IncorrectOperationException {
    final Project project = exp.getProject();
    final PsiElementFactory factory = JavaPsiFacade.getElementFactory(project);
    final PsiExpression newCall = factory.createExpressionFromText(newExpression, null);
    final PsiElement insertedElement = exp.replace(newCall);
    final PsiElement shortenedElement = JavaCodeStyleManager.getInstance(project).shortenClassReferences(insertedElement);
    CodeStyleManager.getInstance(project).reformat(shortenedElement);
  }
public static void replaceExpression(@NotNull String newExpression, @NotNull PsiExpression exp)