in static-analysis/autodispose-error-prone/src/main/java/autodispose2/errorprone/AbstractReturnValueIgnored.java [227:240]
private boolean isValidReturnValueType(ExpressionTree tree, VisitorState state) {
Type returnType = null;
if (tree instanceof MethodInvocationTree) {
returnType = getReturnType(((JCMethodInvocation) tree).getMethodSelect());
} else if (tree instanceof MemberReferenceTree) {
// Get the return type of the target referenced interface
returnType =
state.getTypes().findDescriptorType(((JCMemberReference) tree).type).getReturnType();
}
if (returnType != null) {
return capturedTypeAllowed(returnType, state);
}
return true;
}