@Override public void endVisit(JParameterRef x, Context ctx) { int paramIndex = methodCall.getTarget().getParams().indexOf(x.getParameter()); assert paramIndex != -1; // Replace with a cloned call argument. CloneExpressionVisitor cloner = new CloneExpressionVisitor(); JExpression arg = methodCall.getArgs().get(paramIndex); JExpression clone = cloner.cloneExpression(arg); clone = maybeCast(clone, x.getType()); ctx.replaceMe(clone); }
@Override public void endVisit(JParameterRef x, Context ctx) { if (x.getParameter() == parameter) { ctx.replaceMe(cloner.cloneExpression(expression)); } }