in static-analysis/autodispose-error-prone/src/main/java/autodispose2/errorprone/AbstractReturnValueIgnored.java [82:106]
private Description matchMethodInvocationNew(MethodInvocationTree tree, VisitorState state) {
boolean matches = specializedMatcher().matches(tree, state);
if (!matches) {
return Description.NO_MATCH;
}
if (lenient()) {
boolean isUnusedReturnValue =
allOf(
parentNode(
anyOf(
AbstractReturnValueIgnored::isVoidReturningLambdaExpression,
Matchers.kindIs(Kind.EXPRESSION_STATEMENT))),
not(methodInvocation(toType(IdentifierTree.class, identifierHasName("super")))),
not((t, s) -> isVoidType(getType(t), s)),
not(AbstractReturnValueIgnored::expectedExceptionTest))
.matches(tree, state);
if (!isUnusedReturnValue) {
if (isValidReturnValueType(tree, state)) {
return Description.NO_MATCH;
}
}
}
return describe(tree, state);
}