From 14cf13929f03bbfce7a309ab6628d0e4ffe513d4 Mon Sep 17 00:00:00 2001
From: Jakub Janco <jjanco@redhat.com>
Date: Tue, 13 Feb 2018 11:54:45 +0100
Subject: [PATCH] Remove Guava code for <v18

---
 .../datastax/driver/core/GuavaCompatibility.java   | 48 +---------------------
 pom.xml                                            |  2 +-
 2 files changed, 2 insertions(+), 48 deletions(-)

diff --git a/driver-core/src/main/java/com/datastax/driver/core/GuavaCompatibility.java b/driver-core/src/main/java/com/datastax/driver/core/GuavaCompatibility.java
index 0744197c7..465e8ba1f 100644
--- a/driver-core/src/main/java/com/datastax/driver/core/GuavaCompatibility.java
+++ b/driver-core/src/main/java/com/datastax/driver/core/GuavaCompatibility.java
@@ -133,59 +133,13 @@ public abstract class GuavaCompatibility {
             return new Version19OrHigher();
         } else if (isGuava_16_0_1_OrHigher()) {
             logger.info("Detected Guava < 19 in the classpath, using legacy compatibility layer");
-            return new Version18OrLower();
+            throw new java.lang.UnsupportedOperationException();
         } else {
             throw new DriverInternalError("Detected incompatible version of Guava in the classpath. " +
                     "You need 16.0.1 or higher.");
         }
     }
 
-    private static class Version18OrLower extends GuavaCompatibility {
-
-        @Override
-        public <V> ListenableFuture<V> withFallback(ListenableFuture<? extends V> input,
-                                                    final AsyncFunction<Throwable, V> fallback) {
-            return Futures.withFallback(input, new FutureFallback<V>() {
-                @Override
-                public ListenableFuture<V> create(Throwable t) throws Exception {
-                    return fallback.apply(t);
-                }
-            });
-        }
-
-        @Override
-        public <V> ListenableFuture<V> withFallback(ListenableFuture<? extends V> input,
-                                                    final AsyncFunction<Throwable, V> fallback,
-                                                    Executor executor) {
-            return Futures.withFallback(input, new FutureFallback<V>() {
-                @Override
-                public ListenableFuture<V> create(Throwable t) throws Exception {
-                    return fallback.apply(t);
-                }
-            }, executor);
-        }
-
-        @Override
-        public <I, O> ListenableFuture<O> transformAsync(ListenableFuture<I> input, AsyncFunction<? super I, ? extends O> function) {
-            return Futures.transform(input, function);
-        }
-
-        @Override
-        public <I, O> ListenableFuture<O> transformAsync(ListenableFuture<I> input, AsyncFunction<? super I, ? extends O> function, Executor executor) {
-            return Futures.transform(input, function, executor);
-        }
-
-        @Override
-        public boolean isSupertypeOf(TypeToken<?> target, TypeToken<?> argument) {
-            return target.isAssignableFrom(argument);
-        }
-
-        @Override
-        public Executor sameThreadExecutor() {
-            return MoreExecutors.sameThreadExecutor();
-        }
-    }
-
     private static class Version19OrHigher extends GuavaCompatibility {
 
         @Override
diff --git a/pom.xml b/pom.xml
index 735005db3..e9647bcde 100644
--- a/pom.xml
+++ b/pom.xml
@@ -50,7 +50,7 @@
         <log4j.version>1.2.17</log4j.version>
         <slf4j.version>1.7.25</slf4j.version>
         <slf4j-log4j12.version>1.7.25</slf4j-log4j12.version>
-        <guava.version>19.0</guava.version>
+        <guava.version>20.0</guava.version>
         <netty.version>4.0.47.Final</netty.version>
         <metrics.version>3.2.2</metrics.version>
         <snappy.version>1.1.2.6</snappy.version>
-- 
2.14.3

