Repository: calcite
Updated Branches:
  refs/heads/master 92b425aaa -> d262c860a


Remove dead code: Compatible, CompatibleGuava11

closes #841


Project: http://git-wip-us.apache.org/repos/asf/calcite/repo
Commit: http://git-wip-us.apache.org/repos/asf/calcite/commit/d262c860
Tree: http://git-wip-us.apache.org/repos/asf/calcite/tree/d262c860
Diff: http://git-wip-us.apache.org/repos/asf/calcite/diff/d262c860

Branch: refs/heads/master
Commit: d262c860ac42da453a592b0a4c22426e17f82776
Parents: 92b425a
Author: Vladimir Sitnikov <[email protected]>
Authored: Wed Sep 19 21:22:45 2018 +0300
Committer: Vladimir Sitnikov <[email protected]>
Committed: Thu Sep 20 00:15:13 2018 +0300

----------------------------------------------------------------------
 .../org/apache/calcite/jdbc/CalciteSchema.java  |  11 +-
 .../org/apache/calcite/util/Compatible.java     | 131 -----
 .../apache/calcite/util/CompatibleGuava11.java  | 499 -------------------
 .../org/apache/calcite/util/ReflectUtil.java    |   2 +-
 .../java/org/apache/calcite/util/UtilTest.java  |  13 -
 .../calcite/adapter/druid/DruidSchema.java      |   4 +-
 6 files changed, 8 insertions(+), 652 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/calcite/blob/d262c860/core/src/main/java/org/apache/calcite/jdbc/CalciteSchema.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/jdbc/CalciteSchema.java 
b/core/src/main/java/org/apache/calcite/jdbc/CalciteSchema.java
index 6698810..8e4c897 100644
--- a/core/src/main/java/org/apache/calcite/jdbc/CalciteSchema.java
+++ b/core/src/main/java/org/apache/calcite/jdbc/CalciteSchema.java
@@ -28,7 +28,6 @@ import org.apache.calcite.schema.Table;
 import org.apache.calcite.schema.TableMacro;
 import org.apache.calcite.schema.impl.MaterializedViewTable;
 import org.apache.calcite.schema.impl.StarTable;
-import org.apache.calcite.util.Compatible;
 import org.apache.calcite.util.NameMap;
 import org.apache.calcite.util.NameMultimap;
 import org.apache.calcite.util.NameSet;
@@ -327,7 +326,7 @@ public abstract class CalciteSchema {
         new ImmutableSortedMap.Builder<>(NameSet.COMPARATOR);
     builder.putAll(subSchemaMap.map());
     addImplicitSubSchemaToBuilder(builder);
-    return Compatible.INSTANCE.navigableMap(builder.build());
+    return builder.build();
   }
 
   /** Returns a collection of lattices.
@@ -346,7 +345,7 @@ public abstract class CalciteSchema {
     builder.addAll(tableMap.map().keySet());
     // Add implicit tables, case-sensitive.
     addImplicitTableToBuilder(builder);
-    return Compatible.INSTANCE.navigableSet(builder.build());
+    return builder.build();
   }
 
   /** Returns the set of all types names. */
@@ -357,7 +356,7 @@ public abstract class CalciteSchema {
     builder.addAll(typeMap.map().keySet());
     // Add implicit types.
     addImplicitTypeNamesToBuilder(builder);
-    return Compatible.INSTANCE.navigableSet(builder.build());
+    return builder.build();
   }
 
   /** Returns a type, explicit and implicit, with a given
@@ -393,7 +392,7 @@ public abstract class CalciteSchema {
     builder.addAll(functionMap.map().keySet());
     // Add implicit functions, case-sensitive.
     addImplicitFuncNamesToBuilder(builder);
-    return Compatible.INSTANCE.navigableSet(builder.build());
+    return builder.build();
   }
 
   /** Returns tables derived from explicit and implicit functions
@@ -412,7 +411,7 @@ public abstract class CalciteSchema {
     }
     // add tables derived from implicit functions
     addImplicitTablesBasedOnNullaryFunctionsToBuilder(builder);
-    return Compatible.INSTANCE.navigableMap(builder.build());
+    return builder.build();
   }
 
   /** Returns a tables derived from explicit and implicit functions

http://git-wip-us.apache.org/repos/asf/calcite/blob/d262c860/core/src/main/java/org/apache/calcite/util/Compatible.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/util/Compatible.java 
b/core/src/main/java/org/apache/calcite/util/Compatible.java
deleted file mode 100644
index 6146792..0000000
--- a/core/src/main/java/org/apache/calcite/util/Compatible.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.calcite.util;
-
-import com.google.common.base.Function;
-import com.google.common.collect.ImmutableSortedMap;
-import com.google.common.collect.ImmutableSortedSet;
-import com.google.common.collect.Maps;
-
-import java.lang.reflect.Array;
-import java.lang.reflect.Method;
-import java.lang.reflect.Proxy;
-import java.sql.Connection;
-import java.util.Map;
-import java.util.NavigableMap;
-import java.util.NavigableSet;
-import java.util.Set;
-
-/** Compatibility layer.
- *
- * <p>Allows to use advanced functionality if the latest JDK or Guava version
- * is present.</p>
- */
-public interface Compatible {
-  Compatible INSTANCE = new Factory().create();
-
-  /** Same as Guava {@code Maps.asMap(set, function)} (introduced in
-   * Guava 14.0). */
-  <K, V> Map<K, V> asMap(Set<K> set, Function<? super K, V> function);
-
-  /** Converts a {@link com.google.common.collect.ImmutableSortedSet} to a
-   * {@link java.util.NavigableSet}.  (In Guava 12 and later, 
ImmutableSortedSet
-   * implements NavigableSet.) */
-  <E> NavigableSet<E> navigableSet(ImmutableSortedSet<E> set);
-
-  /** Converts a {@link com.google.common.collect.ImmutableSortedMap} to a
-   * {@link java.util.NavigableMap}. (In Guava 12 and later, ImmutableSortedMap
-   * implements NavigableMap.) */
-  <K, V> NavigableMap<K, V> navigableMap(ImmutableSortedMap<K, V> map);
-
-  /** Converts a {@link Map} to a {@link java.util.NavigableMap} that is
-   * immutable. */
-  <K, V> NavigableMap<K, V> immutableNavigableMap(NavigableMap<K, V> map);
-
-  /** Calls {@link java.sql.Connection}{@code .setSchema(String)}.
-   *
-   * <p>This method is available in JDK 1.7 and above, and in
-   * {@link org.apache.calcite.jdbc.CalciteConnection} in all JDK versions. */
-  @SuppressWarnings("unused") @Deprecated // to be removed before 2.0
-  void setSchema(Connection connection, String schema);
-
-  /** Calls the {@link Method}.{@code getParameters()[i].getName()} method
-   * (introduced in JDK 1.8). */
-  String getParameterName(Method method, int i);
-
-  /** Creates the implementation of Compatible suitable for the
-   * current environment. */
-  class Factory {
-    Compatible create() {
-      return (Compatible) Proxy.newProxyInstance(
-          Compatible.class.getClassLoader(),
-          new Class<?>[] {Compatible.class}, (proxy, method, args) -> {
-            if (method.getName().equals("asMap")) {
-              // Use the Guava implementation Maps.asMap if it is available
-              try {
-                //noinspection ConfusingArgumentToVarargsMethod
-                final Method guavaMethod = Maps.class.getMethod(
-                    method.getName(), method.getParameterTypes());
-                return guavaMethod.invoke(null, args);
-              } catch (NoSuchMethodException e) {
-                Set set = (Set) args[0];
-                Function function = (Function) args[1];
-                return CompatibleGuava11.asMap(set, function);
-              }
-            }
-            if (method.getName().equals("navigableSet")) {
-              ImmutableSortedSet set = (ImmutableSortedSet) args[0];
-              return CompatibleGuava11.navigableSet(set);
-            }
-            if (method.getName().equals("navigableMap")) {
-              ImmutableSortedMap map = (ImmutableSortedMap) args[0];
-              return CompatibleGuava11.navigableMap(map);
-            }
-            if (method.getName().equals("immutableNavigableMap")) {
-              Map map = (Map) args[0];
-              ImmutableSortedMap sortedMap = ImmutableSortedMap.copyOf(map);
-              return CompatibleGuava11.navigableMap(sortedMap);
-            }
-            if (method.getName().equals("setSchema")) {
-              Connection connection = (Connection) args[0];
-              String schema = (String) args[1];
-              final Method method1 =
-                  connection.getClass().getMethod("setSchema", String.class);
-              return method1.invoke(connection, schema);
-            }
-            if (method.getName().equals("getParameterName")) {
-              final Method m = (Method) args[0];
-              final int i = (Integer) args[1];
-              try {
-                final Method method1 =
-                    m.getClass().getMethod("getParameters");
-                Object parameters = method1.invoke(m);
-                final Object parameter = Array.get(parameters, i);
-                final Method method3 =
-                    parameter.getClass().getMethod("getName");
-                return method3.invoke(parameter);
-              } catch (NoSuchMethodException e) {
-                return "arg" + i;
-              }
-            }
-            return null;
-          });
-    }
-  }
-}
-
-// End Compatible.java

http://git-wip-us.apache.org/repos/asf/calcite/blob/d262c860/core/src/main/java/org/apache/calcite/util/CompatibleGuava11.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/util/CompatibleGuava11.java 
b/core/src/main/java/org/apache/calcite/util/CompatibleGuava11.java
deleted file mode 100644
index 6b9dc61..0000000
--- a/core/src/main/java/org/apache/calcite/util/CompatibleGuava11.java
+++ /dev/null
@@ -1,499 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.calcite.util;
-
-import com.google.common.base.Function;
-import com.google.common.collect.Collections2;
-import com.google.common.collect.ForwardingSet;
-import com.google.common.collect.ImmutableSortedMap;
-import com.google.common.collect.ImmutableSortedSet;
-import com.google.common.collect.Maps;
-import com.google.common.collect.Multiset;
-import com.google.common.collect.Sets;
-
-import java.util.AbstractCollection;
-import java.util.AbstractMap;
-import java.util.AbstractSet;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.NavigableMap;
-import java.util.NavigableSet;
-import java.util.Objects;
-import java.util.Set;
-import java.util.TreeMap;
-import java.util.TreeSet;
-
-/** Helper methods to provide modern Guava functionality based on Guava 11.
- *
- * @see Compatible
- */
-class CompatibleGuava11 {
-  private CompatibleGuava11() {}
-
-  public static <K, V> Map<K, V> asMap(
-      Set<K> set, Function<? super K, V> function) {
-    return new AsMapView<K, V>(set, function);
-  }
-
-  /**
-   * {@link AbstractSet} substitute without the potentially-quadratic
-   * {@code removeAll} implementation.
-   *
-   * @param <E> element type
-   */
-  abstract static class ImprovedAbstractSet<E> extends AbstractSet<E> {
-    @Override public boolean removeAll(Collection<?> c) {
-      return removeAllImpl(this, c);
-    }
-
-    @Override public boolean retainAll(Collection<?> c) {
-      return super.retainAll(Objects.requireNonNull(c)); // GWT compatibility
-    }
-  }
-
-  /**
-   * Remove each element in an iterable from a set.
-   */
-  static boolean removeAllImpl(Set<?> set, Iterator<?> iterator) {
-    boolean changed = false;
-    while (iterator.hasNext()) {
-      changed |= set.remove(iterator.next());
-    }
-    return changed;
-  }
-
-  static boolean removeAllImpl(Set<?> set, Collection<?> collection) {
-    Objects.requireNonNull(collection); // for GWT
-    if (collection instanceof Multiset) {
-      collection = ((Multiset<?>) collection).elementSet();
-    }
-
-    // AbstractSet.removeAll(List) has quadratic behavior if the list size
-    // is just less than the set's size.  We augment the test by
-    // assuming that sets have fast contains() performance, and other
-    // collections don't.  See
-    // http://code.google.com/p/guava-libraries/issues/detail?id=1013
-    if (collection instanceof Set && collection.size() > set.size()) {
-      Iterator<?> setIterator = set.iterator();
-      boolean changed = false;
-      while (setIterator.hasNext()) {
-        if (collection.contains(setIterator.next())) {
-          changed = true;
-          setIterator.remove();
-        }
-      }
-      return changed;
-    } else {
-      return removeAllImpl(set, collection.iterator());
-    }
-  }
-
-  /** ImprovedAbstractMap.
-   *
-   * @param <K> key type
-   * @param <V> value type */
-  abstract static class ImprovedAbstractMap<K, V> extends AbstractMap<K, V> {
-    /**
-     * Creates the entry set to be returned by {@link #entrySet()}. This method
-     * is invoked at most once on a given map, at the time when {@code 
entrySet}
-     * is first called.
-     */
-    protected abstract Set<Entry<K, V>> createEntrySet();
-
-    private Set<Entry<K, V>> entrySet;
-
-    @Override public Set<Entry<K, V>> entrySet() {
-      Set<Entry<K, V>> result = entrySet;
-      if (result == null) {
-        entrySet = result = createEntrySet();
-      }
-      return result;
-    }
-
-    private Set<K> keySet;
-
-    @Override public Set<K> keySet() {
-      Set<K> result = keySet;
-      if (result == null) {
-        return keySet = new KeySet<K, V>() {
-          @Override Map<K, V> map() {
-            return ImprovedAbstractMap.this;
-          }
-        };
-      }
-      return result;
-    }
-
-    private Collection<V> values;
-
-    @Override public Collection<V> values() {
-      Collection<V> result = values;
-      if (result == null) {
-        return values = new Values<K, V>() {
-          @Override Map<K, V> map() {
-            return ImprovedAbstractMap.this;
-          }
-        };
-      }
-      return result;
-    }
-  }
-
-  static <K, V> Iterator<K> keyIterator(
-      Iterator<Map.Entry<K, V>> entryIterator) {
-    return new TransformedIterator<Map.Entry<K, V>, K>(entryIterator) {
-      @Override K transform(Map.Entry<K, V> entry) {
-        return entry.getKey();
-      }
-    };
-  }
-
-  /** KeySet.
-   *
-   * @param <K> key type
-   * @param <V> value type */
-  abstract static class KeySet<K, V> extends ImprovedAbstractSet<K> {
-    abstract Map<K, V> map();
-
-    @Override public Iterator<K> iterator() {
-      return keyIterator(map().entrySet().iterator());
-    }
-
-    @Override public int size() {
-      return map().size();
-    }
-
-    @Override public boolean isEmpty() {
-      return map().isEmpty();
-    }
-
-    @Override public boolean contains(Object o) {
-      return map().containsKey(o);
-    }
-
-    @Override public boolean remove(Object o) {
-      if (contains(o)) {
-        map().remove(o);
-        return true;
-      }
-      return false;
-    }
-
-    @Override public void clear() {
-      map().clear();
-    }
-  }
-
-  private static <E> Set<E> removeOnlySet(final Set<E> set) {
-    return new ForwardingSet<E>() {
-      @Override protected Set<E> delegate() {
-        return set;
-      }
-
-      @Override public boolean add(E element) {
-        throw new UnsupportedOperationException();
-      }
-
-      @Override public boolean addAll(Collection<? extends E> es) {
-        throw new UnsupportedOperationException();
-      }
-    };
-  }
-
-  private static <K, V> Iterator<Map.Entry<K, V>> asSetEntryIterator(
-      Set<K> set, final Function<? super K, V> function) {
-    return new TransformedIterator<K, Map.Entry<K, V>>(set.iterator()) {
-      @Override Map.Entry<K, V> transform(K key) {
-        return Maps.immutableEntry(key, function.apply(key));
-      }
-    };
-  }
-
-  /** AsMapView.
-   *
-   * @param <K> key type
-   * @param <V> value type */
-  private static class AsMapView<K, V> extends ImprovedAbstractMap<K, V> {
-    private final Set<K> set;
-    final Function<? super K, V> function;
-
-    Set<K> backingSet() {
-      return set;
-    }
-
-    AsMapView(Set<K> set, Function<? super K, V> function) {
-      this.set = Objects.requireNonNull(set);
-      this.function = Objects.requireNonNull(function);
-    }
-
-    @Override public Set<K> keySet() {
-      // probably not worth caching
-      return removeOnlySet(backingSet());
-    }
-
-    @Override public Collection<V> values() {
-      // probably not worth caching
-      return Collections2.transform(set, function);
-    }
-
-    @Override public int size() {
-      return backingSet().size();
-    }
-
-    @Override public boolean containsKey(Object key) {
-      return backingSet().contains(key);
-    }
-
-    @Override public V get(Object key) {
-      if (backingSet().contains(key)) {
-        @SuppressWarnings("unchecked") // unsafe, but Javadoc warns about it
-            K k = (K) key;
-        return function.apply(k);
-      } else {
-        return null;
-      }
-    }
-
-    @Override public V remove(Object key) {
-      if (backingSet().remove(key)) {
-        @SuppressWarnings("unchecked") // unsafe, but Javadoc warns about it
-            K k = (K) key;
-        return function.apply(k);
-      } else {
-        return null;
-      }
-    }
-
-    @Override public void clear() {
-      backingSet().clear();
-    }
-
-    @Override protected Set<Map.Entry<K, V>> createEntrySet() {
-      return new EntrySet<K, V>() {
-        @Override Map<K, V> map() {
-          return AsMapView.this;
-        }
-
-        @Override public Iterator<Map.Entry<K, V>> iterator() {
-          return asSetEntryIterator(backingSet(), function);
-        }
-      };
-    }
-  }
-
-  /** EntrySet.
-   *
-   * @param <K> key type
-   * @param <V> value type */
-  abstract static class EntrySet<K, V>
-      extends ImprovedAbstractSet<Map.Entry<K, V>> {
-    abstract Map<K, V> map();
-
-    @Override public int size() {
-      return map().size();
-    }
-
-    @Override public void clear() {
-      map().clear();
-    }
-
-    @Override public boolean contains(Object o) {
-      if (o instanceof Map.Entry) {
-        Map.Entry<?, ?> entry = (Map.Entry<?, ?>) o;
-        Object key = entry.getKey();
-        V value = map().get(key);
-        return Objects.equals(value, entry.getValue())
-            && (value != null || map().containsKey(key));
-      }
-      return false;
-    }
-
-    @Override public boolean isEmpty() {
-      return map().isEmpty();
-    }
-
-    @Override public boolean remove(Object o) {
-      if (contains(o)) {
-        Map.Entry<?, ?> entry = (Map.Entry<?, ?>) o;
-        return map().keySet().remove(entry.getKey());
-      }
-      return false;
-    }
-
-    @Override public boolean removeAll(Collection<?> c) {
-      try {
-        return super.removeAll(Objects.requireNonNull(c));
-      } catch (UnsupportedOperationException e) {
-        // if the iterators don't support remove
-        boolean changed = true;
-        for (Object o : c) {
-          changed |= remove(o);
-        }
-        return changed;
-      }
-    }
-
-    @Override public boolean retainAll(Collection<?> c) {
-      try {
-        return super.retainAll(Objects.requireNonNull(c));
-      } catch (UnsupportedOperationException e) {
-        // if the iterators don't support remove
-        Set<Object> keys = Sets.newHashSetWithExpectedSize(c.size());
-        for (Object o : c) {
-          if (contains(o)) {
-            Map.Entry<?, ?> entry = (Map.Entry<?, ?>) o;
-            keys.add(entry.getKey());
-          }
-        }
-        return map().keySet().retainAll(keys);
-      }
-    }
-  }
-
-  static <K, V> Iterator<V> valueIterator(
-      Iterator<Map.Entry<K, V>> entryIterator) {
-    return new TransformedIterator<Map.Entry<K, V>, V>(entryIterator) {
-      @Override V transform(Map.Entry<K, V> entry) {
-        return entry.getValue();
-      }
-    };
-  }
-
-  /** Values.
-   *
-   * @param <K> key type
-   * @param <V> value type */
-  abstract static class Values<K, V> extends AbstractCollection<V> {
-    abstract Map<K, V> map();
-
-    @Override public Iterator<V> iterator() {
-      return valueIterator(map().entrySet().iterator());
-    }
-
-    @Override public boolean remove(Object o) {
-      try {
-        return super.remove(o);
-      } catch (UnsupportedOperationException e) {
-        for (Map.Entry<K, V> entry : map().entrySet()) {
-          if (Objects.equals(o, entry.getValue())) {
-            map().remove(entry.getKey());
-            return true;
-          }
-        }
-        return false;
-      }
-    }
-
-    @Override public boolean removeAll(Collection<?> c) {
-      try {
-        return super.removeAll(Objects.requireNonNull(c));
-      } catch (UnsupportedOperationException e) {
-        Set<K> toRemove = new HashSet<>();
-        for (Map.Entry<K, V> entry : map().entrySet()) {
-          if (c.contains(entry.getValue())) {
-            toRemove.add(entry.getKey());
-          }
-        }
-        return map().keySet().removeAll(toRemove);
-      }
-    }
-
-    @Override public boolean retainAll(Collection<?> c) {
-      try {
-        return super.retainAll(Objects.requireNonNull(c));
-      } catch (UnsupportedOperationException e) {
-        Set<K> toRetain = new HashSet<>();
-        for (Map.Entry<K, V> entry : map().entrySet()) {
-          if (c.contains(entry.getValue())) {
-            toRetain.add(entry.getKey());
-          }
-        }
-        return map().keySet().retainAll(toRetain);
-      }
-    }
-
-    @Override public int size() {
-      return map().size();
-    }
-
-    @Override public boolean isEmpty() {
-      return map().isEmpty();
-    }
-
-    @Override public boolean contains(Object o) {
-      return map().containsValue(o);
-    }
-
-    @Override public void clear() {
-      map().clear();
-    }
-  }
-
-  /** TransformedIterator.
-   *
-   * @param <F> from type
-   * @param <T> to type */
-  abstract static class TransformedIterator<F, T> implements Iterator<T> {
-    final Iterator<? extends F> backingIterator;
-
-    TransformedIterator(Iterator<? extends F> backingIterator) {
-      this.backingIterator = Objects.requireNonNull(backingIterator);
-    }
-
-    abstract T transform(F from);
-
-    public final boolean hasNext() {
-      return backingIterator.hasNext();
-    }
-
-    public final T next() {
-      return transform(backingIterator.next());
-    }
-
-    public final void remove() {
-      backingIterator.remove();
-    }
-  }
-
-  /** Implements {@link Compatible#navigableSet}. */
-  static <E> NavigableSet<E> navigableSet(ImmutableSortedSet<E> set) {
-    if (set instanceof NavigableSet) {
-      // In Guava 12 and later, ImmutableSortedSet implements NavigableSet.
-      //noinspection unchecked
-      return (NavigableSet) set;
-    } else {
-      // In Guava 11, we have to make a copy.
-      return new TreeSet<E>(set);
-    }
-  }
-
-  /** Implements {@link Compatible#navigableMap}. */
-  static <K, V> NavigableMap<K, V> navigableMap(ImmutableSortedMap<K, V> map) {
-    if (map instanceof NavigableMap) {
-      // In Guava 12 and later, ImmutableSortedMap implements NavigableMap.
-      //noinspection unchecked
-      return (NavigableMap) map;
-    } else {
-      // In Guava 11, we have to make a copy.
-      return new TreeMap<K, V>(map);
-    }
-  }
-}
-
-// End CompatibleGuava11.java

http://git-wip-us.apache.org/repos/asf/calcite/blob/d262c860/core/src/main/java/org/apache/calcite/util/ReflectUtil.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/util/ReflectUtil.java 
b/core/src/main/java/org/apache/calcite/util/ReflectUtil.java
index 17f80d6..fc9bd0d 100644
--- a/core/src/main/java/org/apache/calcite/util/ReflectUtil.java
+++ b/core/src/main/java/org/apache/calcite/util/ReflectUtil.java
@@ -558,7 +558,7 @@ public abstract class ReflectUtil {
         return ((Parameter) annotation).name();
       }
     }
-    return Compatible.INSTANCE.getParameterName(method, i);
+    return method.getParameters()[i].getName();
   }
 
   /** Derives whether the {@code i}th parameter of a method is optional. */

http://git-wip-us.apache.org/repos/asf/calcite/blob/d262c860/core/src/test/java/org/apache/calcite/util/UtilTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/calcite/util/UtilTest.java 
b/core/src/test/java/org/apache/calcite/util/UtilTest.java
index b4fce45..db9f337 100644
--- a/core/src/test/java/org/apache/calcite/util/UtilTest.java
+++ b/core/src/test/java/org/apache/calcite/util/UtilTest.java
@@ -38,7 +38,6 @@ import org.apache.calcite.test.Matchers;
 
 import com.google.common.collect.ImmutableList;
 import com.google.common.collect.ImmutableMultiset;
-import com.google.common.collect.ImmutableSortedSet;
 import com.google.common.collect.Iterables;
 import com.google.common.collect.Lists;
 import com.google.common.primitives.Ints;
@@ -1641,18 +1640,6 @@ public class UtilTest {
     assertThat(checkNav(treeSet3, "FOO").size(), equalTo(3));
     assertThat(checkNav(treeSet3, "FoO").size(), equalTo(3));
     assertThat(checkNav(treeSet3, "BAR").size(), equalTo(1));
-
-    final ImmutableSortedSet<String> treeSet4 =
-        ImmutableSortedSet.copyOf(comparator, treeSet);
-    final NavigableSet<String> navigableSet4 =
-        Compatible.INSTANCE.navigableSet(treeSet4);
-    assertThat(treeSet4.size(), equalTo(5));
-    assertThat(navigableSet4.size(), equalTo(5));
-    assertThat(navigableSet4, equalTo((SortedSet<String>) treeSet4));
-    assertThat(checkNav(navigableSet4, "foo").size(), equalTo(3));
-    assertThat(checkNav(navigableSet4, "FOO").size(), equalTo(3));
-    assertThat(checkNav(navigableSet4, "FoO").size(), equalTo(3));
-    assertThat(checkNav(navigableSet4, "BAR").size(), equalTo(1));
   }
 
   private NavigableSet<String> checkNav(NavigableSet<String> set, String s) {

http://git-wip-us.apache.org/repos/asf/calcite/blob/d262c860/druid/src/main/java/org/apache/calcite/adapter/druid/DruidSchema.java
----------------------------------------------------------------------
diff --git 
a/druid/src/main/java/org/apache/calcite/adapter/druid/DruidSchema.java 
b/druid/src/main/java/org/apache/calcite/adapter/druid/DruidSchema.java
index 03d8210..829ff7c 100644
--- a/druid/src/main/java/org/apache/calcite/adapter/druid/DruidSchema.java
+++ b/druid/src/main/java/org/apache/calcite/adapter/druid/DruidSchema.java
@@ -19,12 +19,12 @@ package org.apache.calcite.adapter.druid;
 import org.apache.calcite.schema.Table;
 import org.apache.calcite.schema.impl.AbstractSchema;
 import org.apache.calcite.sql.type.SqlTypeName;
-import org.apache.calcite.util.Compatible;
 
 import com.google.common.cache.CacheBuilder;
 import com.google.common.cache.CacheLoader;
 import com.google.common.collect.ImmutableMap;
 import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.Maps;
 
 import java.util.HashMap;
 import java.util.LinkedHashMap;
@@ -68,7 +68,7 @@ public class DruidSchema extends AbstractSchema {
       final DruidConnectionImpl connection = new DruidConnectionImpl(url, 
coordinatorUrl);
       Set<String> tableNames = connection.tableNames();
 
-      tableMap = Compatible.INSTANCE.asMap(
+      tableMap = Maps.asMap(
           ImmutableSet.copyOf(tableNames),
           CacheBuilder.newBuilder()
               .build(CacheLoader.from(name -> table(name, connection))));

Reply via email to