private static Tree getSingleExplicitTypeArgument(MethodInvocationTree tree) { if (tree.getTypeArguments().isEmpty()) { throw new IllegalArgumentException( "Methods in the Refaster class must be invoked with " + "an explicit type parameter; for example, 'Refaster.<T>isInstance(o)'."); } return Iterables.getOnlyElement(tree.getTypeArguments()); }
@Override public Description matchMethodInvocation(MethodInvocationTree tree, VisitorState state) { return check(tree, tree.getTypeArguments(), state); }
@Override public GuardedByExpression visitMethodInvocation( MethodInvocationTree node, BinderContext context) { checkGuardedBy( node.getArguments().isEmpty() && node.getTypeArguments().isEmpty(), "Only nullary methods are allowed."); ExpressionTree methodSelect = node.getMethodSelect(); switch (methodSelect.getKind()) { case IDENTIFIER: { IdentifierTree identifier = (IdentifierTree) methodSelect; Symbol.MethodSymbol method = context.resolver.resolveMethod(node, identifier.getName()); checkGuardedBy(method != null, identifier.toString()); return bindSelect(computeBase(context, method), method); } case MEMBER_SELECT: { MemberSelectTree select = (MemberSelectTree) methodSelect; GuardedByExpression base = visit(select.getExpression(), context); checkGuardedBy(base != null, select.getExpression().toString()); Symbol.MethodSymbol method = context.resolver.resolveMethod(node, base, select.getIdentifier()); checkGuardedBy(method != null, select.toString()); return bindSelect(normalizeBase(context, method, base), method); } default: throw new IllegalGuardedBy(methodSelect.getKind().toString()); } }
private static Tree getSingleExplicitTypeArgument(MethodInvocationTree tree) { if (tree.getTypeArguments().isEmpty()) { throw new IllegalArgumentException( "Methods in the Refaster class must be invoked with " + "an explicit type parameter; for example, 'Refaster.<T>isInstance(o)'."); } return Iterables.getOnlyElement(tree.getTypeArguments()); }
@Override public Description matchMethodInvocation(MethodInvocationTree tree, VisitorState state) { return check(tree, tree.getTypeArguments(), state); }
@Override public Void visitMethodInvocation(MethodInvocationTree expected, Tree actual) { Optional<MethodInvocationTree> other = checkTypeAndCast(expected, actual); if (!other.isPresent()) { addTypeMismatch(expected, actual); return null; } parallelScan(expected.getTypeArguments(), other.get().getTypeArguments()); scan(expected.getMethodSelect(), other.get().getMethodSelect()); parallelScan(expected.getArguments(), other.get().getArguments()); return null; }
@Override public Void visitMethodInvocation(MethodInvocationTree expected, Tree actual) { Optional<MethodInvocationTree> other = checkTypeAndCast(expected, actual); if (!other.isPresent()) { addTypeMismatch(expected, actual); return null; } parallelScan(expected.getTypeArguments(), other.get().getTypeArguments()); scan(expected.getMethodSelect(), other.get().getMethodSelect()); parallelScan(expected.getArguments(), other.get().getArguments()); return null; }
@Override public Void visitMethodInvocation(MethodInvocationTree expected, Tree actual) { Optional<MethodInvocationTree> other = checkTypeAndCast(expected, actual); if (!other.isPresent()) { addTypeMismatch(expected, actual); return null; } parallelScan(expected.getTypeArguments(), other.get().getTypeArguments()); scan(expected.getMethodSelect(), other.get().getMethodSelect()); parallelScan(expected.getArguments(), other.get().getArguments()); return null; }
private MethodInvocationTree modifyMethodInvocationArgument(MethodInvocationTree methodInvocation, int index, ExpressionTree argument, Operation op) { MethodInvocationTree copy = MethodInvocation( (List<? extends ExpressionTree>) methodInvocation.getTypeArguments(), methodInvocation.getMethodSelect(), c(methodInvocation.getArguments(), index, argument, op) ); return copy; }
private MethodInvocationTree modifyMethodInvocationTypeArgument(MethodInvocationTree methodInvocation, int index, ExpressionTree typeArgument, Operation op) { MethodInvocationTree copy = MethodInvocation( c((List<? extends ExpressionTree>) methodInvocation.getTypeArguments(), index, typeArgument, op), methodInvocation.getMethodSelect(), methodInvocation.getArguments() ); return copy; }
public List<Tree> visitMethodInvocation(MethodInvocationTree node, ExpressionScanner.ExpressionsInfo p) { List<Tree> result = scan(node.getTypeArguments(), p); result = reduce(result, scan(node.getMethodSelect(), p)); result = reduce(result, scan(node.getArguments(), p)); if (result == null) { result = new ArrayList(); } result.add(node); return result; }
@Override public List<Tree> visitMethodInvocation(MethodInvocationTree node, ExpressionScanner.ExpressionsInfo p) { List<Tree> result = scan(node.getTypeArguments(), p); result = reduce(result, scan(node.getMethodSelect(), p)); result = reduce(result, scan(node.getArguments(), p)); if (result == null) { result = new ArrayList<Tree>(); } result.add(node); return result; }
public Boolean visitMethodInvocation(MethodInvocationTree node, TreePath p) { if (p == null) return super.visitMethodInvocation(node, p); MethodInvocationTree t = (MethodInvocationTree) p.getLeaf(); if (!scan(node.getMethodSelect(), t.getMethodSelect(), p)) return false; if (!checkLists(node.getTypeArguments(), t.getTypeArguments(), p)) return false; return checkLists(node.getArguments(), t.getArguments(), p); }
public R visitMethodInvocation(MethodInvocationTree node, P p) { R r = scan(node.getTypeArguments(), p); r = scanAndReduce(node.getMethodSelect(), p, r); r = scanAndReduce(node.getArguments(), p, r); return r; }
public R visitMethodInvocation(MethodInvocationTree node, P p) { R r = scan(node.getTypeArguments(), p); r = scanAndReduce(node.getMethodSelect(), p, r); r = scanAndReduce(node.getArguments(), p, r); return r; }
public R visitMethodInvocation(MethodInvocationTree node, P p) { R r = scan(node.getTypeArguments(), p); r = scanAndReduce(node.getMethodSelect(), p, r); r = scanAndReduce(node.getArguments(), p, r); return r; }
public R visitMethodInvocation(MethodInvocationTree node, P p) { R r = scan(node.getTypeArguments(), p); r = scanAndReduce(node.getMethodSelect(), p, r); r = scanAndReduce(node.getArguments(), p, r); return r; }
@Override public MethodArgument[] visitMethodInvocation(MethodInvocationTree node, Object p) { if (!methodInvocation || offset != positions.getEndPosition(tree, node.getMethodSelect())) { return super.visitMethodInvocation(node, p); /*MethodArgument[] r = scan(node.getTypeArguments(), p); r = scanAndReduce(node.getMethodSelect(), p, r); r = scanAndReduce(node.getArguments(), p, r); return r;*/ } List<? extends ExpressionTree> args = node.getArguments(); List<? extends Tree> argTypes = node.getTypeArguments(); /*int n = args.size(); arguments = new MethodArgument[n]; for (int i = 0; i < n; i++) { arguments[i] = new MethodArgument(args.get(i).toString(), argTypes.get(i).toString()); } return arguments;*/ arguments = composeArguments(args, argTypes); return arguments; }
@Override public MethodArgument[] visitMethodInvocation(MethodInvocationTree node, Object p) { if (!methodInvocation || offset != positions.getEndPosition(tree, node.getMethodSelect())) { return super.visitMethodInvocation(node, p); /*MethodArgument[] r = scan(node.getTypeArguments(), p); r = scanAndReduce(node.getMethodSelect(), p, r); r = scanAndReduce(node.getArguments(), p, r); return r;*/ } List<? extends ExpressionTree> args = node.getArguments(); List<? extends Tree> argTypes = node.getTypeArguments(); /*int n = args.size(); arguments = new MethodArgument[n]; for (int i = 0; i < n; i++) { arguments[i] = new MethodArgument(args.get(i).toString(), argTypes.get(i).toString()); } return arguments;*/ arguments = composeArguments(args, argTypes); return arguments; }
@Override public Tree visitMethodInvocation(MethodInvocationTree tree, Void p) { MethodInvocationTree n = make.MethodInvocation((List<? extends ExpressionTree>)tree.getTypeArguments(), tree.getMethodSelect(), tree.getArguments()); model.setType(n, model.getType(tree)); comments.copyComments(tree, n); model.setPos(n, model.getPos(tree)); return n; }