@Override public Choice<State<JCMethodInvocation>> visitMethodInvocation( final MethodInvocationTree node, State<?> state) { return chooseSubtrees( state, s -> unifyExpression(node.getMethodSelect(), s), s -> unifyExpressions(node.getArguments(), s), (select, args) -> maker().Apply(null, select, args)); }
@Override public JCMethodInvocation inline(Inliner inliner) throws CouldNotResolveImportException { return inliner .maker() .Apply( com.sun.tools.javac.util.List.<JCExpression>nil(), getMethodSelect().inline(inliner), inliner.<JCExpression>inlineList(getArguments())); } }
private static JCMethodInvocation createSyntheticShadowAccess( MethodInvocationTree shadowOfCall, String newFieldName, Symbol originalSymbol, VisitorState state) { TreeMaker treeMaker = state.getTreeMaker(); Symbol newSymbol = createSymbol(originalSymbol, state.getName(newFieldName), ((JCExpression) shadowOfCall.getArguments().get(0)).type); JCExpression methodSelect = (JCExpression) shadowOfCall.getMethodSelect(); if (methodSelect instanceof JCIdent) { // clone so start pos can be changed... methodSelect = treeMaker.Ident(((JCIdent) shadowOfCall.getMethodSelect()).sym); } JCMethodInvocation callShadowOf = treeMaker.Apply( null, methodSelect, com.sun.tools.javac.util.List.of(createIdent(treeMaker, newSymbol))); callShadowOf.type = ((JCMethodInvocation) shadowOfCall).type; return callShadowOf; }
private JCMethodInvocation createSyntheticShadowAccess(VisitorState state) { TreeMaker treeMaker = state.getTreeMaker(); JCExpression application = treeMaker.Select( treeMaker.Ident(findSymbol(state, "org.robolectric.RuntimeEnvironment")), findSymbol(state, "org.robolectric.RuntimeEnvironment", "application")); JCExpression shadowOfApp = treeMaker.Select( treeMaker.Ident(findSymbol(state, "org.robolectric.Shadows")), findSymbol(state, "org.robolectric.Shadows", "shadowOf(android.app.Application)")); JCMethodInvocation callShadowOf = treeMaker.Apply(null, shadowOfApp, com.sun.tools.javac.util.List.of(application)); callShadowOf.type = callShadowOf.meth.type; return callShadowOf; }
/** * Create a method invocation from a method tree and a list of * argument trees. */ public JCMethodInvocation App(JCExpression meth, List<JCExpression> args) { return Apply(null, meth, args).setType(meth.type.getReturnType()); }
/** * Create a method invocation from a method tree and a list of * argument trees. */ public JCMethodInvocation App(JCExpression meth, List<JCExpression> args) { return Apply(null, meth, args).setType(meth.type.getReturnType()); }
JCMethodInvocation arguments(List<JCExpression> typeArgs, JCExpression t) { int pos = token.pos; List<JCExpression> args = arguments(); return toP(F.at(pos).Apply(typeArgs, t, args)); }
/** * Create a no-arg method invocation from a method tree */ public JCMethodInvocation App(JCExpression meth) { return Apply(null, meth, List.<JCExpression>nil()).setType(meth.type.getReturnType()); }
/** * Create a no-arg method invocation from a method tree */ public JCMethodInvocation App(JCExpression meth) { return Apply(null, meth, List.<JCExpression>nil()).setType(meth.type.getReturnType()); }
/** * Create a no-arg method invocation from a method tree */ public JCMethodInvocation App(JCExpression meth) { return Apply(null, meth, List.<JCExpression>nil()).setType(meth.type.getReturnType()); }
JCMethodInvocation arguments(List<JCExpression> typeArgs, JCExpression t) { int pos = token.pos; List<JCExpression> args = arguments(); return toP(F.at(pos).Apply(typeArgs, t, args)); }
JCMethodInvocation arguments(List<JCExpression> typeArgs, JCExpression t) { int pos = S.pos(); List<JCExpression> args = arguments(); return toP(F.at(pos).Apply(typeArgs, t, args)); }
JCMethodInvocation arguments(List<JCExpression> typeArgs, JCExpression t) { int pos = S.pos(); List<JCExpression> args = arguments(); return toP(F.at(pos).Apply(typeArgs, t, args)); }
public JCTree visitMethodInvocation(MethodInvocationTree node, P p) { JCMethodInvocation t = (JCMethodInvocation) node; List<JCExpression> typeargs = copy(t.typeargs, p); JCExpression meth = copy(t.meth, p); List<JCExpression> args = copy(t.args, p); return M.at(t.pos).Apply(typeargs, meth, args); }
public JCTree visitMethodInvocation(MethodInvocationTree node, P p) { JCMethodInvocation t = (JCMethodInvocation) node; List<JCExpression> typeargs = copy(t.typeargs, p); JCExpression meth = copy(t.meth, p); List<JCExpression> args = copy(t.args, p); return M.at(t.pos).Apply(typeargs, meth, args); }
public JCTree visitMethodInvocation(MethodInvocationTree node, P p) { JCMethodInvocation t = (JCMethodInvocation) node; List<JCExpression> typeargs = copy(t.typeargs, p); JCExpression meth = copy(t.meth, p); List<JCExpression> args = copy(t.args, p); return M.at(t.pos).Apply(typeargs, meth, args); }
@Override public JCMethodInvocation inline(Inliner inliner) throws CouldNotResolveImportException { return inliner .maker() .Apply( com.sun.tools.javac.util.List.<JCExpression>nil(), getMethodSelect().inline(inliner), inliner.<JCExpression>inlineList(getArguments())); } }
@Override public Choice<State<JCMethodInvocation>> visitMethodInvocation( final MethodInvocationTree node, State<?> state) { return chooseSubtrees( state, s -> unifyExpression(node.getMethodSelect(), s), s -> unifyExpressions(node.getArguments(), s), (select, args) -> maker().Apply(null, select, args)); }
public MethodInvocationTree MethodInvocation(List<? extends ExpressionTree> typeArguments, ExpressionTree method, List<? extends ExpressionTree> arguments) { ListBuffer<JCExpression> typeargs = new ListBuffer<JCExpression>(); for (ExpressionTree t : typeArguments) typeargs.append((JCExpression)t); ListBuffer<JCExpression> args = new ListBuffer<JCExpression>(); for (ExpressionTree t : arguments) args.append((JCExpression)t); return make.at(NOPOS).Apply(typeargs.toList(), (JCExpression)method, args.toList()); }
private JCExpression deserGetter(String func, Type type, List<Type> argTypes, List<JCExpression> args) { MethodType getmt = new MethodType(argTypes, type, List.<Type>nil(), syms.methodClass); Symbol getsym = rs.resolveQualifiedMethod(null, attrEnv, syms.serializedLambdaType, names.fromString(func), argTypes, List.<Type>nil()); return make.Apply( List.<JCExpression>nil(), make.Select(make.Ident(kInfo.deserParamSym).setType(syms.serializedLambdaType), getsym).setType(getmt), args).setType(type); }