GuavaCompatibility.isGuava_19_0_OrHigher() is broken for Guava 26

Description

GuavaCompatibility.isGuava_19_0_OrHigher() as implemented in is broken in the recently released Guava 26.

The method checks for the existence of Futures.transformAsync(ListenableFuture, AsyncFunction) but this (previously deprecated) method has been removed in Guava 26 causing the the method to return false.
This causes the driver to assume an older version of Guava and try to load the removed Guava class FutureFallback
which leads to ClassNotFoundException: com.google.common.util.concurrent.FutureFallback.

The Guava deprecation comment suggests replacing usages of this method with Futures.transformAsync(ListenableFuture, AsyncFunction, Executor) using MoreExecutors.directExecutor() for identical behaviour but also points to the documentation of ListenableFuture.addListener for a discussion on why this might not be be safest executor to use:

"For fast, lightweight listeners that would be safe to execute in any thread, consider MoreExecutors.directExecutor. Otherwise, avoid it. Heavyweight directExecutor listeners can cause problems, and these problems can be difficult to reproduce because they depend on timing."

Environment

None

Pull Requests

None

Activity

Show:
Andy Tolbert
August 6, 2018, 1:03 PM

, thank you for bringing this up! As Futures.transformAsync(ListenableFuture, AsyncFunction, Executor) is present in 19.0, it looks like we'll be able to make this work without breaking compatibility with older versions.

This should be an easy fix, so I targeted it for our next release. The last time we made changes for guava we ran a regression suite against all versions 16.0.1+. We'll do the same for this.

Andy Tolbert
August 6, 2018, 1:05 PM

With regards to this:

"For fast, lightweight listeners that would be safe to execute in any thread, consider MoreExecutors.directExecutor. Otherwise, avoid it. Heavyweight directExecutor listeners can cause problems, and these problems can be difficult to reproduce because they depend on timing."

I'll verify that directExecutor is safe in all context of our use of transformAsync. That should be the case, but I'll check.

Andy Tolbert
August 6, 2018, 7:29 PM
Edited

It looks like a number of methods were removed in Guava 26 that broke our compatibility. I believe I've teased them all out, and have a PR opened here. I have an internal jenkins regression running against 11 different guava versions (16.0.1 - 26) and it seems to be going well so far.

Fixed

Assignee

Andy Tolbert

Reporter

Christian Nedregård

Labels

None

PM Priority

None

Reproduced in

3.5.1

Affects versions

None

Fix versions

Pull Request

None

Doc Impact

None

Size

None

External issue ID

None

External issue ID

None

Priority

Major
Configure