Skip to content

JAVA-1328: Provide compatibility with Guava 20#784

Merged
adutra merged 1 commit into
3.xfrom
java1328
Feb 16, 2017
Merged

JAVA-1328: Provide compatibility with Guava 20#784
adutra merged 1 commit into
3.xfrom
java1328

Conversation

@olim7t

@olim7t olim7t commented Jan 11, 2017

Copy link
Copy Markdown
Contributor

Based on original work by @mspangdal.

@olim7t olim7t added this to the 3.0.7 milestone Jan 11, 2017
@adutra

adutra commented Jan 12, 2017

Copy link
Copy Markdown
Contributor

Is there a compelling reason to target 3.0.7 instead of 3.2.0? I would personally be more comfortable with 3.2.0.

}
}

private static class Version18OrLower extends GuavaCompatibility {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: adding @SuppressWarnings("deprecation") here would spare us a couple warnings.

private static Manifest loadGuavaManifest() {
InputStream in = null;
try {
Enumeration<URL> resources = Resources.class.getClassLoader()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resources is itself part of Guava, and is marked @Beta. Why not use GuavaCompatibility.class.getClassLoader()?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I hadn't noticed it was beta. I think it's better to use a Guava class to make sure it's the classloader that loaded Guava, I've changed it to Preconditions.


@Override
public <I, O> ListenableFuture<O> transformAsync(ListenableFuture<I> input, AsyncFunction<? super I, ? extends O> function, Executor executor) {
return Futures.transform(input, function, executor);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Found one occurrence of this method in com.datastax.driver.core.AsyncQueryTest#connectAndQuery

* They are available in some versions of Java/Guava, but not across all versions ranges supported by the driver, hence
* the custom implementation.
*/
public class MoreObjects {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since it's public, maybe we could add javadocs for methods in this class, even if I concede that their purposes are pretty obvious.

@@ -40,8 +40,8 @@
public class LimitingLoadBalancingPolicy extends DelegatingLoadBalancingPolicy {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The import import com.google.common.collect.Sets is unused.

@adutra

adutra commented Jan 18, 2017

Copy link
Copy Markdown
Contributor

In addition to my review, we should also

  1. in /pom.xml, replace the javadoc link with this one:
 <link>https://google.github.io/guava/releases/20.0/api/docs/</link>
  1. Replace links to code.google.com/p/guava-libraries with github.com/google/guava; this happens in two files at least: CloseFuture.java and ResultSetFuture.java.

@olim7t

olim7t commented Jan 18, 2017

Copy link
Copy Markdown
Contributor Author

Addressed all feedback.

@tolbertam

Copy link
Copy Markdown
Contributor

Is there a compelling reason to target 3.0.7 instead of 3.2.0? I would personally be more comfortable with 3.2.0.

That's a good point, it doesn't break API compatibility, but is more of a new capability than a hotfix so 3.2.0 does seem more appropriate.

@tolbertam

Copy link
Copy Markdown
Contributor

CI looks happy with guava 16.0.1, 17.0, 18.0, 19.0, 20.0 and 21.0, excellent work!

@olim7t olim7t modified the milestones: 3.2.0, 3.0.7 Jan 18, 2017
@Xaerxess

Copy link
Copy Markdown

Glad to see this approved! Is there any chance for a release in the near future?

@adutra

adutra commented Jan 24, 2017

Copy link
Copy Markdown
Contributor

@Xaerxess no timeframe yet, but it shouldn't be long.

@adutra

adutra commented Feb 9, 2017

Copy link
Copy Markdown
Contributor

Squashed and rebased on top of 3.x instead of 3.0.x.

@adutra

adutra commented Feb 9, 2017

Copy link
Copy Markdown
Contributor

Note to reviewers: I added an extra commit to fix OSGi tests and also to revert the Import-Package instruction that we use to create our bundles. We need to explicitly declare that the driver bundle accepts any Guava version in the range [16.0.1,21) so I modified the instructions to read that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants