@Override public Description matchMethod(MethodTree tree, VisitorState state) { if (tree.getTypeParameters().isEmpty()) { return Description.NO_MATCH; } return findShadowedTypes(tree, tree.getTypeParameters(), state); }
@Override public Description matchMethod(MethodTree tree, VisitorState state) { if (tree.getTypeParameters().isEmpty()) { return Description.NO_MATCH; } return findDuplicatesOf(tree, tree.getTypeParameters(), state); }
@Override public Description matchMethod(MethodTree methodTree, VisitorState state) { DocTreePath path = getDocTreePath(state); if (path != null) { ImmutableSet<String> parameters = methodTree.getParameters().stream() .map(v -> v.getName().toString()) .collect(toImmutableSet()); ImmutableSet<String> typeParameters = methodTree.getTypeParameters().stream() .map(t -> t.getName().toString()) .collect(toImmutableSet()); new ParamsChecker(state, methodTree, parameters, typeParameters).scan(path, null); } return Description.NO_MATCH; }
@Override public Description matchMethod(MethodTree tree, VisitorState state) { if (tree.getTypeParameters().isEmpty()) { return Description.NO_MATCH; } return findDuplicatesOf(tree, tree.getTypeParameters(), state); }
@Override public Description matchMethod(MethodTree tree, VisitorState state) { if (tree.getTypeParameters().isEmpty()) { return Description.NO_MATCH; } return findShadowedTypes(tree, tree.getTypeParameters(), state); }
public IJavaClassTypeVariable[] getTypeParameters() { if (_typeParameters == null) { final List<? extends TypeParameterTree> typeParameters = _method.getTypeParameters(); if (!typeParameters.isEmpty()) { _typeParameters = new IJavaClassTypeVariable[typeParameters.size()]; for (int i = 0; i < _typeParameters.length; i++) { _typeParameters[i] = JavaSourceTypeVariable.create(this, typeParameters.get(i)); } } else { _typeParameters = JavaSourceTypeVariable.EMPTY; } } return _typeParameters; }
@Override public Description matchMethod(MethodTree methodTree, VisitorState state) { DocTreePath path = getDocTreePath(state); if (path != null) { ImmutableSet<String> parameters = methodTree.getParameters().stream() .map(v -> v.getName().toString()) .collect(toImmutableSet()); ImmutableSet<String> typeParameters = methodTree.getTypeParameters().stream() .map(t -> t.getName().toString()) .collect(toImmutableSet()); new ParamsChecker(state, methodTree, parameters, typeParameters).scan(path, null); } return Description.NO_MATCH; }
@Override public Void visitMethod(MethodTree expected, Tree actual) { Optional<MethodTree> other = checkTypeAndCast(expected, actual); if (!other.isPresent()) { addTypeMismatch(expected, actual); return null; } checkForDiff(expected.getName().contentEquals(other.get().getName()), "Expected method name to be <%s> but was <%s>.", expected.getName(), other.get().getName()); scan(expected.getModifiers(), other.get().getModifiers()); scan(expected.getReturnType(), other.get().getReturnType()); parallelScan(expected.getTypeParameters(), other.get().getTypeParameters()); parallelScan(expected.getParameters(), other.get().getParameters()); parallelScan(expected.getThrows(), other.get().getThrows()); scan(expected.getBody(), other.get().getBody()); scan(expected.getDefaultValue(), other.get().getDefaultValue()); return null; }
@Override public Void visitMethod(MethodTree expected, Tree actual) { Optional<MethodTree> other = checkTypeAndCast(expected, actual); if (!other.isPresent()) { addTypeMismatch(expected, actual); return null; } checkForDiff(expected.getName().contentEquals(other.get().getName()), "Expected method name to be <%s> but was <%s>.", expected.getName(), other.get().getName()); scan(expected.getModifiers(), other.get().getModifiers()); scan(expected.getReturnType(), other.get().getReturnType()); parallelScan(expected.getTypeParameters(), other.get().getTypeParameters()); parallelScan(expected.getParameters(), other.get().getParameters()); parallelScan(expected.getThrows(), other.get().getThrows()); scan(expected.getBody(), other.get().getBody()); scan(expected.getDefaultValue(), other.get().getDefaultValue()); return null; }
@Override public Void visitMethod(MethodTree expected, Tree actual) { Optional<MethodTree> other = checkTypeAndCast(expected, actual); if (!other.isPresent()) { addTypeMismatch(expected, actual); return null; } checkForDiff(expected.getName().contentEquals(other.get().getName()), "Expected method name to be <%s> but was <%s>.", expected.getName(), other.get().getName()); scan(expected.getModifiers(), other.get().getModifiers()); scan(expected.getReturnType(), other.get().getReturnType()); parallelScan(expected.getTypeParameters(), other.get().getTypeParameters()); parallelScan(expected.getParameters(), other.get().getParameters()); parallelScan(expected.getThrows(), other.get().getThrows()); scan(expected.getBody(), other.get().getBody()); scan(expected.getDefaultValue(), other.get().getDefaultValue()); return null; }
@Override public Tree visitMethod(MethodTree tree, Void p) { MethodTree n = make.Method((ModifiersTree) tree.getModifiers(), tree.getName().toString(), (ExpressionTree) tree.getReturnType(), tree.getTypeParameters(), tree.getParameters(), tree.getThrows(), tree.getBody(), (ExpressionTree) tree.getDefaultValue()); comments.copyComments(tree, n); model.setPos(n, model.getPos(tree)); return n; }
private MethodTree modifyMethodParameter(MethodTree method, int index, VariableTree parameter, Operation op) { MethodTree copy = Method( method.getModifiers(), method.getName(), method.getReturnType(), method.getTypeParameters(), c(method.getParameters(), index, parameter, op), method.getThrows(), method.getBody(), (ExpressionTree) method.getDefaultValue() ); return copy; }
private MethodTree modifyMethodTypeParameter(MethodTree method, int index, TypeParameterTree typeParameter, Operation op) { MethodTree copy = Method( method.getModifiers(), method.getName(), method.getReturnType(), c(method.getTypeParameters(), index, typeParameter, op), method.getParameters(), method.getThrows(), method.getBody(), (ExpressionTree) method.getDefaultValue() ); return copy; }
private MethodTree modifyMethodThrows(MethodTree method, int index, ExpressionTree throwz, Operation op) { MethodTree copy = Method( method.getModifiers(), method.getName(), method.getReturnType(), method.getTypeParameters(), method.getParameters(), c(method.getThrows(), index, throwz, op), method.getBody(), (ExpressionTree) method.getDefaultValue() ); return copy; }
@Override public Boolean visitMethod(MethodTree node, Stack<Tree> p) { scan(node.getModifiers(), p); scan(node.getReturnType(), p); scan(node.getTypeParameters(), p); scan(node.getParameters(), p); scan(node.getThrows(), p); return scan(node.getBody(), p); }
public R visitMethod(MethodTree node, P p) { R r = scan(node.getModifiers(), p); r = scanAndReduce(node.getReturnType(), p, r); r = scanAndReduce(node.getTypeParameters(), p, r); r = scanAndReduce(node.getParameters(), p, r); r = scanAndReduce(node.getThrows(), p, r); r = scanAndReduce(node.getBody(), p, r); return r; }
public R visitMethod(MethodTree node, P p) { R r = scan(node.getModifiers(), p); r = scanAndReduce(node.getReturnType(), p, r); r = scanAndReduce(node.getTypeParameters(), p, r); r = scanAndReduce(node.getParameters(), p, r); r = scanAndReduce(node.getThrows(), p, r); r = scanAndReduce(node.getBody(), p, r); return r; }
public Object run(WorkingCopy wc) { TreeMaker make = wc.getTreeMaker(); ExecutableElement execElement = execElementHandle.resolve(wc); MethodTree methodTree = wc.getTrees().getTree(execElement); MethodTree newMethodTree = wc.getTreeMaker().Method(methodTree.getModifiers(), methodTree.getName(), methodTree.getReturnType(), methodTree.getTypeParameters(), methodTree.getParameters(), methodTree.getThrows(), "{" + bodyText + "}", (ExpressionTree)methodTree.getDefaultValue()); wc.rewrite(methodTree, newMethodTree); return null; } }, javaClass.getFileObject());
public R visitMethod(MethodTree node, P p) { R r = scan(node.getModifiers(), p); r = scanAndReduce(node.getReturnType(), p, r); r = scanAndReduce(node.getTypeParameters(), p, r); r = scanAndReduce(node.getParameters(), p, r); r = scanAndReduce(node.getReceiverParameter(), p, r); r = scanAndReduce(node.getThrows(), p, r); r = scanAndReduce(node.getBody(), p, r); r = scanAndReduce(node.getDefaultValue(), p, r); return r; }
public R visitMethod(MethodTree node, P p) { R r = scan(node.getModifiers(), p); r = scanAndReduce(node.getReturnType(), p, r); r = scanAndReduce(node.getTypeParameters(), p, r); r = scanAndReduce(node.getParameters(), p, r); r = scanAndReduce(node.getReceiverParameter(), p, r); r = scanAndReduce(node.getThrows(), p, r); r = scanAndReduce(node.getBody(), p, r); r = scanAndReduce(node.getDefaultValue(), p, r); return r; }