@Override public Void visitMethodInvocation(MethodInvocationTree tree, Void unused) { if (!tree.equals(methodInvocationTree)) { count.incrementAndGet(); } return super.visitMethodInvocation(tree, null); }
@Override public Void visitMethodInvocation(MethodInvocationTree methodTree, Void unused) { if (methodTree.equals(tree)) { isTerminalCondition.set(true); } return super.visitMethodInvocation(methodTree, null); }
@Override public Boolean visitMethodInvocation(MethodInvocationTree tree, VisitorState state) { boolean b1 = BYTE_BUFFER_ALLOWED_INITIALIZERS_MATCHER.matches(tree, state); boolean b2 = super.visitMethodInvocation(tree, state); return b1 || b2; }
@Override public Boolean visitMethodInvocation(MethodInvocationTree node, Void unused) { if (UNLOCK.matches(node, state)) { return releases(node, lockee, state); } return super.visitMethodInvocation(node, null); } }.scan(tryTree.getFinallyBlock(), null);
@Override public Boolean visitMethodInvocation(MethodInvocationTree callTree, Void unused) { return super.visitMethodInvocation(callTree, unused) || DESCRIPTION_WITH_FIX.matches(callTree, state); }
@Override public Boolean visitMethodInvocation(MethodInvocationTree node, Void unused) { String name = getSymbol(node).getSimpleName().toString(); return name.contains("assert") || name.contains("verify") || name.contains("check") || name.contains("fail") || name.contains("expect") || firstNonNull(super.visitMethodInvocation(node, null), false); }
@Override public Boolean visitMethodInvocation(MethodInvocationTree callTree, Void unused) { if (methodSymbol.equals(getSymbol(callTree.getMethodSelect()))) { return true; } return super.visitMethodInvocation(callTree, unused); }
@Override public Void visitMethodInvocation(MethodInvocationTree tree, Void unused) { MethodSymbol symbol = getSymbol(tree); if (symbol != null) { if (knownMethods.containsKey(symbol)) { accessedFields.addAll(knownMethods.get(symbol)); } else if (!symbol.isStatic() && !acceptableMethods.matches(tree, state)) { failed = true; } } return super.visitMethodInvocation(tree, null); }
@Override public Void visitMethodInvocation(MethodInvocationTree methodInvocationTree, Void aVoid) { addToResult(ASTHelpers.getSymbol(methodInvocationTree), methodInvocationTree); return super.visitMethodInvocation(methodInvocationTree, aVoid); }
@Override public Void visitMethodInvocation(MethodInvocationTree tree, Void unused) { check(ASTHelpers.getReceiver(tree)); return super.visitMethodInvocation(tree, unused); }
@Override public Void visitMethodInvocation(MethodInvocationTree callTree, Void unused) { if (sym.equals(getSymbol(getReceiver(callTree)))) { MethodSymbol methodSymbol = getSymbol(callTree); if (methodSymbol != null) { methodMap.put(methodSymbol.getSimpleName().toString(), callTree); } } return super.visitMethodInvocation(callTree, unused); } },
@Override public Void visitMethodInvocation(MethodInvocationTree node, Void unused) { if (COMPARISON_METHOD.matches(node, state)) { getDubiousComparison( classSymbol, node, node.getArguments().get(0), node.getArguments().get(1)) .ifPresent(suspiciousComparisons::add); } if (instanceEqualsInvocation().matches(node, state)) { ExpressionTree receiver = getReceiver(node); if (receiver != null) { // Special-case super, for odd cases like `super.equals(this)`. if (!receiver.toString().equals("super")) { getDubiousComparison(classSymbol, node, receiver, node.getArguments().get(0)) .ifPresent(suspiciousComparisons::add); } } } return super.visitMethodInvocation(node, null); } }.scan(tree, null);
@Override public Void visitMethodInvocation(MethodInvocationTree tree, VisitorState state) { if (valid) { return null; } Symbol bufferSymbol = ASTHelpers.getSymbol(ASTHelpers.getReceiver(tree)); if (searchedBufferSymbol.equals(bufferSymbol)) { if (BYTE_BUFFER_ARRAY_MATCHER.matches(tree, state)) { visited = true; } else if (BYTE_BUFFER_ARRAY_OFFSET_MATCHER.matches(tree, state)) { valid = true; } } return super.visitMethodInvocation(tree, state); }
@Override public Void visitMethodInvocation(MethodInvocationTree tree, ExpressionTree optionalVar) { if (tree.getArguments().stream().anyMatch(m -> ASTHelpers.sameVariable(m, optionalVar))) { hasAssignment = true; } ExpressionTree receiver = ASTHelpers.getReceiver(tree); if (receiver != null && ASTHelpers.sameVariable(receiver, optionalVar)) { ExpressionTree treeIdent = tree.getMethodSelect(); if (treeIdent instanceof MemberSelectTree) { if (((MemberSelectTree) treeIdent).getIdentifier().contentEquals("get")) { hasGet = true; } } } return super.visitMethodInvocation(tree, optionalVar); }
@Override public Boolean visitMethodInvocation(MethodInvocationTree tree, Void unused) { boolean result = false; MethodSymbol methodSym = ASTHelpers.getSymbol(tree); if (methodSym != null) { ExpressionTree methodSelect = tree.getMethodSelect(); if (methodSelect.getKind() == Kind.MEMBER_SELECT) { MemberSelectTree memberSelect = (MemberSelectTree) methodSelect; result = isSuper(memberSelect.getExpression()) && memberSelect.getIdentifier().contentEquals(overridingMethodName); } } return result || super.visitMethodInvocation(tree, unused); }
@Override public Void visitMethodInvocation(MethodInvocationTree tree, Void unused) { if (STATIC_ASSERT.matches(tree, state)) { String assertType = ASTHelpers.getSymbol(tree).getSimpleName().toString(); fix.addStaticImport("org.junit.Assert." + assertType); } return super.visitMethodInvocation(tree, unused); } },
@Override public Void visitMethodInvocation(MethodInvocationTree node, Void unused) { if (found[0]) { return null; } if (MOCKITO_MATCHER.matches(node, state)) { Type stubber = ASTHelpers.getReturnType(node); if (!stubber.getTypeArguments().isEmpty() && ASTHelpers.isSameType( getOnlyElement(stubber.getTypeArguments()), type, state)) { found[0] = true; } } return super.visitMethodInvocation(node, null); } },
@Override public Void visitMethodInvocation(MethodInvocationTree tree, VisitorState state) { VisitorState nowState = state.withPath(TreePath.getPath(state.getPath(), tree)); if (!inShadowClass) { for (MethodInvocationMatcher matcher : matchers) { if (matcher.matcher().matches(tree, state)) { matcher.replace(tree, nowState, fixBuilder, possibleFixes); return null; } } } return super.visitMethodInvocation(tree, nowState); } }.scan(tree, state);
@Override public Void visitMethodInvocation(MethodInvocationTree node, Void data) { MethodSymbol method = ASTHelpers.getSymbol(node); if (method != null && !method.isConstructor() && !method.isStatic() && !method.isPrivate() && !method.getModifiers().contains(Modifier.FINAL) && isOnThis(node) && method.isMemberOf(classSym, state.getTypes())) { state.reportMatch(describeMatch(node)); } return super.visitMethodInvocation(node, data); } },
@Override public Void visitMethodInvocation(MethodInvocationTree tree, VisitorState state) { VisitorState nowState = state.withPath(TreePath.getPath(state.getPath(), tree)); if (!inShadowClass && shadowStaticMatcher.matches(tree, nowState)) { // Replace ShadowXxx.method() with Xxx.method() where possible... JCFieldAccess methodSelect = (JCFieldAccess) tree.getMethodSelect(); ClassSymbol owner = (ClassSymbol) methodSelect.sym.owner; ClassType shadowedClass = determineShadowedClassName(owner, nowState); String shadowedTypeName = SuggestedFixes.prettyType(state, possibleFixes.fixBuilder, shadowedClass); possibleFixes.fixByReplacing(methodSelect.selected, shadowedTypeName); } if (!inShadowClass && shadowOfMatcher.matches(tree, nowState)) { matchedShadowOf(tree, nowState); } return super.visitMethodInvocation(tree, nowState); } }