void (GrExpression expression, @NlsSafe String newExpression) { final GroovyPsiElementFactory factory = GroovyPsiElementFactory.getInstance(expression.getProject()); final GrExpression newCall = factory.createExpressionFromText(newExpression, expression.getContext()); expression.replaceWithExpression(newCall, true); }