@Override public void visitApply(JCMethodInvocation node) { if (node.args != null && node.args.size() > 0) { changeNode = (lm, ne) -> { // メソッドの引数を置換 if (node.args.contains(lm)) { Stream<JCExpression> newArgs = node.args.stream().map(a -> (a == lm) ? ne : a); node.args = com.sun.tools.javac.util.List.from(newArgs::iterator); } }; } super.visitApply(node); }
@Override public Void visitMethodInvocation(final MethodInvocationTree tree, final Void p) { JCMethodInvocation methodInvocation = (JCMethodInvocation) tree; methodInvocation.args = replace(methodInvocation.args); return super.visitMethodInvocation(tree, p); }