Browse Source

Cleanup dead code in org.elasticsearch.common (#87820)

Just some obvious static cleanup of this package. Should be trivial
to review since it's deletes only and still compiles/tests fine.
Armin Braun 3 years ago
parent
commit
faae31cca6
45 changed files with 3 additions and 504 deletions
  1. 0 19
      server/src/main/java/org/elasticsearch/common/Classes.java
  2. 0 13
      server/src/main/java/org/elasticsearch/common/StopWatch.java
  3. 0 22
      server/src/main/java/org/elasticsearch/common/Strings.java
  4. 0 19
      server/src/main/java/org/elasticsearch/common/collect/ImmutableOpenMap.java
  5. 0 17
      server/src/main/java/org/elasticsearch/common/collect/MapBuilder.java
  6. 0 5
      server/src/main/java/org/elasticsearch/common/component/AbstractLifecycleComponent.java
  7. 0 2
      server/src/main/java/org/elasticsearch/common/component/LifecycleComponent.java
  8. 0 2
      server/src/main/java/org/elasticsearch/common/compress/Compressor.java
  9. 0 5
      server/src/main/java/org/elasticsearch/common/compress/DeflateCompressor.java
  10. 0 17
      server/src/main/java/org/elasticsearch/common/geo/GeoUtils.java
  11. 0 6
      server/src/main/java/org/elasticsearch/common/hash/MurmurHash3.java
  12. 0 8
      server/src/main/java/org/elasticsearch/common/inject/Binder.java
  13. 0 8
      server/src/main/java/org/elasticsearch/common/inject/DeferredLookups.java
  14. 0 8
      server/src/main/java/org/elasticsearch/common/inject/Injector.java
  15. 1 2
      server/src/main/java/org/elasticsearch/common/inject/InjectorImpl.java
  16. 0 2
      server/src/main/java/org/elasticsearch/common/inject/Lookups.java
  17. 1 2
      server/src/main/java/org/elasticsearch/common/inject/spi/Elements.java
  18. 1 2
      server/src/main/java/org/elasticsearch/common/inject/spi/Message.java
  19. 0 16
      server/src/main/java/org/elasticsearch/common/io/Streams.java
  20. 0 21
      server/src/main/java/org/elasticsearch/common/io/UTF8StreamWriter.java
  21. 0 4
      server/src/main/java/org/elasticsearch/common/io/stream/ByteArrayStreamInput.java
  22. 0 9
      server/src/main/java/org/elasticsearch/common/io/stream/BytesStreamOutput.java
  23. 0 3
      server/src/main/java/org/elasticsearch/common/io/stream/DelayableWriteable.java
  24. 0 1
      server/src/main/java/org/elasticsearch/common/io/stream/RecyclerBytesStreamOutput.java
  25. 0 4
      server/src/main/java/org/elasticsearch/common/io/stream/StreamOutput.java
  26. 0 11
      server/src/main/java/org/elasticsearch/common/lucene/BytesRefs.java
  27. 0 3
      server/src/main/java/org/elasticsearch/common/recycler/Recyclers.java
  28. 0 13
      server/src/main/java/org/elasticsearch/common/regex/Regex.java
  29. 0 4
      server/src/main/java/org/elasticsearch/common/settings/AbstractScopedSettings.java
  30. 0 47
      server/src/main/java/org/elasticsearch/common/settings/Setting.java
  31. 0 3
      server/src/main/java/org/elasticsearch/common/time/DateUtils.java
  32. 0 13
      server/src/main/java/org/elasticsearch/common/time/WriteableZoneId.java
  33. 0 8
      server/src/main/java/org/elasticsearch/common/util/BigArrays.java
  34. 0 10
      server/src/main/java/org/elasticsearch/common/util/BigFloatArray.java
  35. 0 48
      server/src/main/java/org/elasticsearch/common/util/CuckooFilter.java
  36. 0 5
      server/src/main/java/org/elasticsearch/common/util/FloatArray.java
  37. 0 12
      server/src/main/java/org/elasticsearch/common/util/concurrent/TimedRunnable.java
  38. 0 22
      server/src/main/java/org/elasticsearch/common/util/iterable/Iterables.java
  39. 0 60
      server/src/main/java/org/elasticsearch/common/xcontent/support/XContentMapValues.java
  40. 0 5
      server/src/main/java/org/elasticsearch/repositories/FilterRepository.java
  41. 0 3
      server/src/test/java/org/elasticsearch/cluster/NodeConnectionsServiceTests.java
  42. 0 5
      server/src/test/java/org/elasticsearch/common/util/concurrent/EWMATrackingEsThreadPoolExecutorTests.java
  43. 0 5
      server/src/test/java/org/elasticsearch/repositories/RepositoriesServiceTests.java
  44. 0 5
      test/framework/src/main/java/org/elasticsearch/common/util/MockBigArrays.java
  45. 0 5
      test/framework/src/main/java/org/elasticsearch/test/transport/StubbableTransport.java

+ 0 - 19
server/src/main/java/org/elasticsearch/common/Classes.java

@@ -12,25 +12,6 @@ import java.lang.reflect.Modifier;
 
 public class Classes {
 
-    /**
-     * The package separator character '.'
-     */
-    private static final char PACKAGE_SEPARATOR = '.';
-
-    /**
-     * Determine the name of the package of the given class:
-     * e.g. "java.lang" for the <code>java.lang.String</code> class.
-     *
-     * @param clazz the class
-     * @return the package name, or the empty String if the class
-     *         is defined in the default package
-     */
-    public static String getPackageName(Class<?> clazz) {
-        String className = clazz.getName();
-        int lastDotIndex = className.lastIndexOf(PACKAGE_SEPARATOR);
-        return (lastDotIndex != -1 ? className.substring(0, lastDotIndex) : "");
-    }
-
     public static boolean isInnerClass(Class<?> clazz) {
         return Modifier.isStatic(clazz.getModifiers()) == false && clazz.getEnclosingClass() != null;
     }

+ 0 - 13
server/src/main/java/org/elasticsearch/common/StopWatch.java

@@ -8,7 +8,6 @@
 
 package org.elasticsearch.common;
 
-import org.elasticsearch.core.Releasable;
 import org.elasticsearch.core.TimeValue;
 
 import java.text.NumberFormat;
@@ -131,18 +130,6 @@ public class StopWatch {
         return this;
     }
 
-    public Releasable timing(String taskName) {
-        start(taskName);
-        return this::stop;
-    }
-
-    /**
-     * Return whether the stop watch is currently running.
-     */
-    public boolean isRunning() {
-        return this.running;
-    }
-
     /**
      * Return the time taken by the last task.
      */

+ 0 - 22
server/src/main/java/org/elasticsearch/common/Strings.java

@@ -279,17 +279,6 @@ public class Strings {
         return sb.toString();
     }
 
-    /**
-     * Delete all occurrences of the given substring.
-     *
-     * @param inString the original String
-     * @param pattern  the pattern to delete all occurrences of
-     * @return the resulting String
-     */
-    public static String delete(String inString, String pattern) {
-        return replace(inString, pattern, "");
-    }
-
     /**
      * Delete any character in a given String.
      *
@@ -316,17 +305,6 @@ public class Strings {
     // Convenience methods for working with formatted Strings
     // ---------------------------------------------------------------------
 
-    /**
-     * Quote the given String with single quotes.
-     *
-     * @param str the input String (e.g. "myString")
-     * @return the quoted String (e.g. "'myString'"),
-     *         or <code>null</code> if the input was <code>null</code>
-     */
-    public static String quote(String str) {
-        return (str != null ? "'" + str + "'" : null);
-    }
-
     /**
      * Capitalize a <code>String</code>, changing the first letter to
      * upper case as per {@link Character#toUpperCase(char)}.

+ 0 - 19
server/src/main/java/org/elasticsearch/common/collect/ImmutableOpenMap.java

@@ -465,15 +465,6 @@ public final class ImmutableOpenMap<KType, VType> extends AbstractMap<KType, VTy
             }
         }
 
-        /**
-         * Remove that can be used in the fluent pattern.
-         */
-        public Builder<KType, VType> fRemove(KType key) {
-            maybeCloneMap();
-            mutableMap.remove(key);
-            return this;
-        }
-
         public VType remove(KType key) {
             maybeCloneMap();
             return mutableMap.remove(key);
@@ -509,11 +500,6 @@ public final class ImmutableOpenMap<KType, VType> extends AbstractMap<KType, VTy
             return new KeySet<>(mutableMap.keys());
         }
 
-        @SuppressWarnings("unchecked")
-        public <K, V> Builder<K, V> cast() {
-            return (Builder) this;
-        }
-
         public int removeAll(BiPredicate<? super KType, ? super VType> predicate) {
             maybeCloneMap();
             return mutableMap.removeAll(predicate::test);
@@ -524,11 +510,6 @@ public final class ImmutableOpenMap<KType, VType> extends AbstractMap<KType, VTy
             return mutableMap.indexOf(key);
         }
 
-        public boolean indexExists(int index) {
-            maybeCloneMap();
-            return mutableMap.indexExists(index);
-        }
-
         public void release() {
             maybeCloneMap();
             mutableMap.release();

+ 0 - 17
server/src/main/java/org/elasticsearch/common/collect/MapBuilder.java

@@ -47,23 +47,6 @@ public class MapBuilder<K, V> {
         return this;
     }
 
-    public MapBuilder<K, V> clear() {
-        this.map.clear();
-        return this;
-    }
-
-    public V get(K key) {
-        return map.get(key);
-    }
-
-    public boolean containsKey(K key) {
-        return map.containsKey(key);
-    }
-
-    public boolean isEmpty() {
-        return map.isEmpty();
-    }
-
     public Map<K, V> map() {
         return this.map;
     }

+ 0 - 5
server/src/main/java/org/elasticsearch/common/component/AbstractLifecycleComponent.java

@@ -31,11 +31,6 @@ public abstract class AbstractLifecycleComponent implements LifecycleComponent {
         listeners.add(listener);
     }
 
-    @Override
-    public void removeLifecycleListener(LifecycleListener listener) {
-        listeners.remove(listener);
-    }
-
     @Override
     public void start() {
         synchronized (lifecycle) {

+ 0 - 2
server/src/main/java/org/elasticsearch/common/component/LifecycleComponent.java

@@ -16,8 +16,6 @@ public interface LifecycleComponent extends Releasable {
 
     void addLifecycleListener(LifecycleListener listener);
 
-    void removeLifecycleListener(LifecycleListener listener);
-
     void start();
 
     void stop();

+ 0 - 2
server/src/main/java/org/elasticsearch/common/compress/Compressor.java

@@ -18,8 +18,6 @@ public interface Compressor {
 
     boolean isCompressed(BytesReference bytes);
 
-    int headerLength();
-
     /**
      * Creates a new input stream that decompresses the contents read from the provided input stream.
      * Closing the returned {@link InputStream} will close the provided stream input.

+ 0 - 5
server/src/main/java/org/elasticsearch/common/compress/DeflateCompressor.java

@@ -58,11 +58,6 @@ public class DeflateCompressor implements Compressor {
         return true;
     }
 
-    @Override
-    public int headerLength() {
-        return HEADER.length;
-    }
-
     // Reusable inflater reference for streaming decompression
     private static final ThreadLocal<ReleasableReference<Inflater>> inflaterForStreamRef = ThreadLocal.withInitial(() -> {
         final Inflater inflater = new Inflater(true);

+ 0 - 17
server/src/main/java/org/elasticsearch/common/geo/GeoUtils.java

@@ -37,12 +37,6 @@ public class GeoUtils {
     /** Minimum valid longitude in degrees. */
     public static final double MIN_LON = -180.0;
 
-    public static final String LATITUDE = "lat";
-    public static final String LONGITUDE = "lon";
-    public static final String GEOHASH = "geohash";
-    public static final String COORDINATES = "coordinates";
-    public static final String TYPE = "type";
-
     /** Earth ellipsoid major axis defined by WGS 84 in meters */
     public static final double EARTH_SEMI_MAJOR_AXIS = 6378137.0;      // meters (WGS 84)
 
@@ -52,9 +46,6 @@ public class GeoUtils {
     /** Earth mean radius defined by WGS 84 in meters */
     public static final double EARTH_MEAN_RADIUS = 6371008.7714D;      // meters (WGS 84)
 
-    /** Earth axis ratio defined by WGS 84 (0.996647189335) */
-    public static final double EARTH_AXIS_RATIO = EARTH_SEMI_MINOR_AXIS / EARTH_SEMI_MAJOR_AXIS;
-
     /** Earth ellipsoid equator length in meters */
     public static final double EARTH_EQUATOR = 2 * Math.PI * EARTH_SEMI_MAJOR_AXIS;
 
@@ -508,14 +499,6 @@ public class GeoUtils {
         return precision;
     }
 
-    /** Returns the maximum distance/radius (in meters) from the point 'center' before overlapping */
-    public static double maxRadialDistanceMeters(final double centerLat, final double centerLon) {
-        if (Math.abs(centerLat) == MAX_LAT) {
-            return SloppyMath.haversinMeters(centerLat, centerLon, 0, centerLon);
-        }
-        return SloppyMath.haversinMeters(centerLat, centerLon, centerLat, (MAX_LON + centerLon) % 360);
-    }
-
     /** Return the distance (in meters) between 2 lat,lon geo points using the haversine method implemented by lucene */
     public static double arcDistance(double lat1, double lon1, double lat2, double lon2) {
         return SloppyMath.haversinMeters(lat1, lon1, lat2, lon2);

+ 0 - 6
server/src/main/java/org/elasticsearch/common/hash/MurmurHash3.java

@@ -71,12 +71,6 @@ public enum MurmurHash3 {
     private static long C1 = 0x87c37b91114253d5L;
     private static long C2 = 0x4cf5ad432745937fL;
 
-    protected static long getblock(byte[] key, int offset, int index) {
-        int i_8 = index << 3;
-        int blockOffset = offset + i_8;
-        return ByteUtils.readLongLE(key, blockOffset);
-    }
-
     protected static long fmix(long k) {
         k ^= k >>> 33;
         k *= 0xff51afd7ed558ccdL;

+ 0 - 8
server/src/main/java/org/elasticsearch/common/inject/Binder.java

@@ -214,14 +214,6 @@ public interface Binder {
      */
     void addError(String message, Object... arguments);
 
-    /**
-     * Records an exception, the full details of which will be logged, and the
-     * message of which will be presented to the user at a later
-     * time. If your Module calls something that you worry may fail, you should
-     * catch the exception and pass it into this.
-     */
-    void addError(Throwable t);
-
     /**
      * Records an error message to be presented to the user at a later time.
      *

+ 0 - 8
server/src/main/java/org/elasticsearch/common/inject/DeferredLookups.java

@@ -18,7 +18,6 @@ package org.elasticsearch.common.inject;
 
 import org.elasticsearch.common.inject.internal.Errors;
 import org.elasticsearch.common.inject.spi.Element;
-import org.elasticsearch.common.inject.spi.ProviderLookup;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -45,11 +44,4 @@ class DeferredLookups implements Lookups {
         new LookupProcessor(errors).process(injector, lookups);
     }
 
-    @Override
-    public <T> Provider<T> getProvider(Key<T> key) {
-        ProviderLookup<T> lookup = new ProviderLookup<>(key, key);
-        lookups.add(lookup);
-        return lookup.getProvider();
-    }
-
 }

+ 0 - 8
server/src/main/java/org/elasticsearch/common/inject/Injector.java

@@ -55,14 +55,6 @@ public interface Injector {
      */
     <T> Provider<T> getProvider(Key<T> key);
 
-    /**
-     * Returns the provider used to obtain instances for the given type. When feasible, avoid
-     * using this method, in favor of having Guice inject your dependencies ahead of time.
-     *
-     * @throws ConfigurationException if this injector cannot find or create the provider.
-     */
-    <T> Provider<T> getProvider(Class<T> type);
-
     /**
      * Returns the appropriate instance for the given injection key; equivalent to {@code
      * getProvider(key).get()}. When feasible, avoid using this method, in favor of having Guice

+ 1 - 2
server/src/main/java/org/elasticsearch/common/inject/InjectorImpl.java

@@ -601,8 +601,7 @@ class InjectorImpl implements Injector, Lookups {
      */
     MembersInjectorStore membersInjectorStore;
 
-    @Override
-    public <T> Provider<T> getProvider(Class<T> type) {
+    private <T> Provider<T> getProvider(Class<T> type) {
         return getProvider(Key.get(type));
     }
 

+ 0 - 2
server/src/main/java/org/elasticsearch/common/inject/Lookups.java

@@ -24,6 +24,4 @@ package org.elasticsearch.common.inject;
  */
 interface Lookups {
 
-    <T> Provider<T> getProvider(Key<T> key);
-
 }

+ 1 - 2
server/src/main/java/org/elasticsearch/common/inject/spi/Elements.java

@@ -144,8 +144,7 @@ public final class Elements {
             elements.add(new Message(getSource(), Errors.format(message, arguments)));
         }
 
-        @Override
-        public void addError(Throwable t) {
+        private void addError(Throwable t) {
             String message = "An exception was caught and reported. Message: " + t.getMessage();
             elements.add(new Message(Collections.singletonList(getSource()), message, t));
         }

+ 1 - 2
server/src/main/java/org/elasticsearch/common/inject/spi/Message.java

@@ -25,8 +25,7 @@ import java.util.Objects;
 
 /**
  * An error message and the context in which it occurred. Messages are usually created internally by
- * Guice and its extensions. Messages can be created explicitly in a module using {@link
- * org.elasticsearch.common.inject.Binder#addError(Throwable) addError()} statements:
+ * Guice and its extensions.
  * <pre>
  *     try {
  *       bindPropertiesFromFile();

+ 0 - 16
server/src/main/java/org/elasticsearch/common/io/Streams.java

@@ -136,22 +136,6 @@ public abstract class Streams {
         return out.toString();
     }
 
-    public static int readFully(Reader reader, char[] dest) throws IOException {
-        return readFully(reader, dest, 0, dest.length);
-    }
-
-    public static int readFully(Reader reader, char[] dest, int offset, int len) throws IOException {
-        int read = 0;
-        while (read < len) {
-            final int r = reader.read(dest, offset + read, len - read);
-            if (r == -1) {
-                break;
-            }
-            read += r;
-        }
-        return read;
-    }
-
     public static int readFully(InputStream reader, byte[] dest) throws IOException {
         return readFully(reader, dest, 0, dest.length);
     }

+ 0 - 21
server/src/main/java/org/elasticsearch/common/io/UTF8StreamWriter.java

@@ -243,27 +243,6 @@ public final class UTF8StreamWriter extends Writer {
         }
     }
 
-    /**
-     * Writes the specified character sequence.
-     *
-     * @param csq the character sequence.
-     * @throws IOException if an I/O error occurs
-     */
-    public void write(CharSequence csq) throws IOException {
-        final int length = csq.length();
-        for (int i = 0; i < length;) {
-            char c = csq.charAt(i++);
-            if (c < 0x80) {
-                _bytes[_index] = (byte) c;
-                if (++_index >= _bytes.length) {
-                    flushBuffer();
-                }
-            } else {
-                write(c);
-            }
-        }
-    }
-
     /**
      * Flushes the stream.  If the stream has saved any characters from the
      * various write() methods in a buffer, write them immediately to their

+ 0 - 4
server/src/main/java/org/elasticsearch/common/io/stream/ByteArrayStreamInput.java

@@ -54,10 +54,6 @@ public class ByteArrayStreamInput extends StreamInput {
         limit = offset + len;
     }
 
-    public int length() {
-        return limit;
-    }
-
     public void skipBytes(long count) {
         pos += count;
     }

+ 0 - 9
server/src/main/java/org/elasticsearch/common/io/stream/BytesStreamOutput.java

@@ -108,7 +108,6 @@ public class BytesStreamOutput extends BytesStream {
         // nothing to do
     }
 
-    @Override
     public void seek(long position) {
         ensureCapacity(position);
         count = (int) position;
@@ -172,14 +171,6 @@ public class BytesStreamOutput extends BytesStream {
         }
     }
 
-    /**
-     * Returns the number of bytes used by the underlying {@link org.elasticsearch.common.util.ByteArray}
-     * @see org.elasticsearch.common.util.ByteArray#ramBytesUsed()
-     */
-    public long ramBytesUsed() {
-        return bytes.ramBytesUsed();
-    }
-
     protected void ensureCapacity(long offset) {
         if (offset > Integer.MAX_VALUE) {
             throw new IllegalArgumentException(getClass().getSimpleName() + " cannot hold more than 2GB of data");

+ 0 - 3
server/src/main/java/org/elasticsearch/common/io/stream/DelayableWriteable.java

@@ -262,8 +262,5 @@ public abstract class DelayableWriteable<T extends Writeable> implements Writeab
             size = 0;
         }
 
-        public long length() {
-            return size;
-        }
     }
 }

+ 0 - 1
server/src/main/java/org/elasticsearch/common/io/stream/RecyclerBytesStreamOutput.java

@@ -157,7 +157,6 @@ public class RecyclerBytesStreamOutput extends BytesStream implements Releasable
         // nothing to do
     }
 
-    @Override
     public void seek(long position) {
         ensureCapacityFromPosition(position);
         this.pageIndex = (int) position / pageSize;

+ 0 - 4
server/src/main/java/org/elasticsearch/common/io/stream/StreamOutput.java

@@ -97,10 +97,6 @@ public abstract class StreamOutput extends OutputStream {
         throw new UnsupportedOperationException();
     }
 
-    public void seek(long position) throws IOException {
-        throw new UnsupportedOperationException();
-    }
-
     /**
      * Writes a single byte.
      */

+ 0 - 11
server/src/main/java/org/elasticsearch/common/lucene/BytesRefs.java

@@ -9,7 +9,6 @@
 package org.elasticsearch.common.lucene;
 
 import org.apache.lucene.util.BytesRef;
-import org.apache.lucene.util.BytesRefBuilder;
 
 public class BytesRefs {
 
@@ -40,14 +39,4 @@ public class BytesRefs {
         return new BytesRef(value.toString());
     }
 
-    public static BytesRef toBytesRef(Object value, BytesRefBuilder spare) {
-        if (value == null) {
-            return null;
-        }
-        if (value instanceof BytesRef) {
-            return (BytesRef) value;
-        }
-        spare.copyChars(value.toString());
-        return spare.get();
-    }
 }

+ 0 - 3
server/src/main/java/org/elasticsearch/common/recycler/Recyclers.java

@@ -137,7 +137,4 @@ public enum Recyclers {
         };
     }
 
-    public static <T> Recycler<T> concurrent(final Recycler.Factory<T> factory) {
-        return concurrent(factory, Runtime.getRuntime().availableProcessors());
-    }
 }

+ 0 - 13
server/src/main/java/org/elasticsearch/common/regex/Regex.java

@@ -182,19 +182,6 @@ public class Regex {
         return patterns != null && simpleMatch(patterns.toArray(Strings.EMPTY_ARRAY), str);
     }
 
-    public static boolean simpleMatch(String[] patterns, String[] types) {
-        if (patterns != null && types != null) {
-            for (String type : types) {
-                for (String pattern : patterns) {
-                    if (simpleMatch(pattern, type)) {
-                        return true;
-                    }
-                }
-            }
-        }
-        return false;
-    }
-
     public static Pattern compile(String regex, String flags) {
         int pFlags = flags == null ? 0 : flagsFromString(flags);
         return Pattern.compile(regex, pFlags);

+ 0 - 4
server/src/main/java/org/elasticsearch/common/settings/AbstractScopedSettings.java

@@ -134,10 +134,6 @@ public abstract class AbstractScopedSettings {
         return AFFIX_KEY_PATTERN.matcher(key).matches();
     }
 
-    public Setting.Property getScope() {
-        return this.scope;
-    }
-
     /**
      * Validates the given settings by running it through all update listeners without applying it. This
      * method will not change any settings but will fail if any of the settings can't be applied.

+ 0 - 47
server/src/main/java/org/elasticsearch/common/settings/Setting.java

@@ -1409,10 +1409,6 @@ public class Setting<T> implements ToXContentObject {
         return value;
     }
 
-    public static long parseLong(String s, long minValue, String key) {
-        return parseLong(s, minValue, key, false);
-    }
-
     static long parseLong(String s, long minValue, String key, boolean isFiltered) {
         long value = Long.parseLong(s);
         if (value < minValue) {
@@ -1422,14 +1418,6 @@ public class Setting<T> implements ToXContentObject {
         return value;
     }
 
-    public static TimeValue parseTimeValue(String s, TimeValue minValue, String key) {
-        TimeValue timeValue = TimeValue.parseTimeValue(s, null, key);
-        if (timeValue.millis() < minValue.millis()) {
-            throw new IllegalArgumentException("Failed to parse value [" + s + "] for setting [" + key + "] must be >= " + minValue);
-        }
-        return timeValue;
-    }
-
     public static Setting<Integer> intSetting(String key, int defaultValue, Property... properties) {
         return intSetting(key, defaultValue, Integer.MIN_VALUE, properties);
     }
@@ -1442,22 +1430,6 @@ public class Setting<T> implements ToXContentObject {
         return new Setting<>(key, fallbackSetting, b -> parseBoolean(b, key, isFiltered(properties)), properties);
     }
 
-    public static Setting<Boolean> boolSetting(
-        String key,
-        Setting<Boolean> fallbackSetting,
-        Validator<Boolean> validator,
-        Property... properties
-    ) {
-        return new Setting<>(
-            new SimpleKey(key),
-            fallbackSetting,
-            fallbackSetting::getRaw,
-            b -> parseBoolean(b, key, isFiltered(properties)),
-            validator,
-            properties
-        );
-    }
-
     public static Setting<Boolean> boolSetting(String key, boolean defaultValue, Validator<Boolean> validator, Property... properties) {
         return new Setting<>(key, Boolean.toString(defaultValue), b -> parseBoolean(b, key, isFiltered(properties)), validator, properties);
     }
@@ -1686,25 +1658,6 @@ public class Setting<T> implements ToXContentObject {
         return listSetting(key, fallbackSetting, singleValueParser, (s) -> parseableStringToList(fallbackSetting.getRaw(s)), properties);
     }
 
-    public static <T> Setting<List<T>> listSetting(
-        final String key,
-        final Function<String, T> singleValueParser,
-        final Function<Settings, List<String>> defaultStringValue,
-        final Property... properties
-    ) {
-        return listSetting(key, null, singleValueParser, defaultStringValue, properties);
-    }
-
-    public static <T> Setting<List<T>> listSetting(
-        final String key,
-        final Function<String, T> singleValueParser,
-        final Function<Settings, List<String>> defaultStringValue,
-        final Validator<List<T>> validator,
-        final Property... properties
-    ) {
-        return listSetting(key, null, singleValueParser, defaultStringValue, validator, properties);
-    }
-
     public static <T> Setting<List<T>> listSetting(
         final String key,
         final @Nullable Setting<List<T>> fallbackSetting,

+ 0 - 3
server/src/main/java/org/elasticsearch/common/time/DateUtils.java

@@ -19,7 +19,6 @@ import java.time.ZonedDateTime;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.Map;
-import java.util.Set;
 
 import static java.util.Map.entry;
 import static org.elasticsearch.common.time.DateUtilsRounding.getMonthOfYear;
@@ -34,7 +33,6 @@ public class DateUtils {
     private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(DateUtils.class);
     // pkg private for tests
     static final Map<String, String> DEPRECATED_SHORT_TIMEZONES;
-    public static final Set<String> DEPRECATED_SHORT_TZ_IDS;
     static {
         Map<String, String> tzs = new HashMap<>();
         tzs.put("EST", "-05:00"); // eastern time without daylight savings
@@ -43,7 +41,6 @@ public class DateUtils {
         tzs.put("ROC", "Asia/Taipei");
         tzs.put("Eire", "Europe/London");
         DEPRECATED_SHORT_TIMEZONES = Collections.unmodifiableMap(tzs);
-        DEPRECATED_SHORT_TZ_IDS = tzs.keySet();
     }
 
     // Map of deprecated timezones and their recommended new counterpart

+ 0 - 13
server/src/main/java/org/elasticsearch/common/time/WriteableZoneId.java

@@ -8,7 +8,6 @@
 
 package org.elasticsearch.common.time;
 
-import org.elasticsearch.common.io.stream.StreamInput;
 import org.elasticsearch.common.io.stream.StreamOutput;
 import org.elasticsearch.common.io.stream.Writeable;
 import org.elasticsearch.xcontent.ToXContentFragment;
@@ -29,18 +28,6 @@ public class WriteableZoneId implements Writeable, ToXContentFragment {
         this.zoneId = zoneId;
     }
 
-    public WriteableZoneId(StreamInput in) throws IOException {
-        zoneId = ZoneId.of(in.readString());
-    }
-
-    public static WriteableZoneId of(String input) {
-        return new WriteableZoneId(ZoneId.of(input));
-    }
-
-    public ZoneId zoneId() {
-        return zoneId;
-    }
-
     @Override
     public void writeTo(StreamOutput out) throws IOException {
         out.writeString(zoneId.getId());

+ 0 - 8
server/src/main/java/org/elasticsearch/common/util/BigArrays.java

@@ -334,14 +334,6 @@ public class BigArrays {
             return ret;
         }
 
-        @Override
-        public float increment(long index, float inc) {
-            assert index >= 0 && index < size();
-            final float ret = (float) VH_PLATFORM_NATIVE_FLOAT.get(array, (int) index << 2) + inc;
-            VH_PLATFORM_NATIVE_FLOAT.set(array, (int) index << 2, ret);
-            return ret;
-        }
-
         @Override
         public void fill(long fromIndex, long toIndex, float value) {
             assert fromIndex >= 0 && fromIndex <= toIndex;

+ 0 - 10
server/src/main/java/org/elasticsearch/common/util/BigFloatArray.java

@@ -50,16 +50,6 @@ final class BigFloatArray extends AbstractBigArray implements FloatArray {
         return ret;
     }
 
-    @Override
-    public float increment(long index, float inc) {
-        final int pageIndex = pageIndex(index);
-        final int indexInPage = indexInPage(index);
-        final byte[] page = pages[pageIndex];
-        final float newVal = (float) VH_PLATFORM_NATIVE_FLOAT.get(page, indexInPage << 2) + inc;
-        VH_PLATFORM_NATIVE_FLOAT.set(page, indexInPage << 2, newVal);
-        return newVal;
-    }
-
     @Override
     public float get(long index) {
         final int pageIndex = pageIndex(index);

+ 0 - 48
server/src/main/java/org/elasticsearch/common/util/CuckooFilter.java

@@ -620,54 +620,6 @@ public class CuckooFilter implements Writeable {
             blocks[elementPos + 1] = blocks[elementPos + 1] & (~0L >>> endBits) | (value << (BLOCK_SIZE - endBits));
         }
 
-        public int set(int index, long[] arr, int off, int len) {
-            assert len > 0 : "len must be > 0 (got " + len + ")";
-            assert index >= 0 && index < valueCount;
-            len = Math.min(len, valueCount - index);
-            assert off + len <= arr.length;
-
-            final int originalIndex = index;
-            final PackedInts.Encoder encoder = PackedInts.getEncoder(PackedInts.Format.PACKED, PackedInts.VERSION_CURRENT, bitsPerValue);
-
-            // go to the next block where the value does not span across two blocks
-            final int offsetInBlocks = index % encoder.longValueCount();
-            if (offsetInBlocks != 0) {
-                for (int i = offsetInBlocks; i < encoder.longValueCount() && len > 0; ++i) {
-                    set(index++, arr[off++]);
-                    --len;
-                }
-                if (len == 0) {
-                    return index - originalIndex;
-                }
-            }
-
-            // bulk set
-            assert index % encoder.longValueCount() == 0;
-            int blockIndex = (int) (((long) index * bitsPerValue) >>> BLOCK_BITS);
-            assert (((long) index * bitsPerValue) & MOD_MASK) == 0;
-            final int iterations = len / encoder.longValueCount();
-            encoder.encode(arr, off, blocks, blockIndex, iterations);
-            final int setValues = iterations * encoder.longValueCount();
-            index += setValues;
-            len -= setValues;
-            assert len >= 0;
-
-            if (index > originalIndex) {
-                // stay at the block boundary
-                return index - originalIndex;
-            } else {
-                // no progress so far => already at a block boundary but no full block to get
-                assert index == originalIndex;
-                len = Math.min(len, size() - index);
-                assert off + len <= arr.length;
-
-                for (int i = index, o = off, end = index + len; i < end; ++i, ++o) {
-                    set(i, arr[o]);
-                }
-                return len;
-            }
-        }
-
         public long ramBytesUsed() {
             return RamUsageEstimator.alignObjectSize(
                 RamUsageEstimator.NUM_BYTES_OBJECT_HEADER + 3 * Integer.BYTES   // bpvMinusBlockSize,valueCount,bitsPerValue

+ 0 - 5
server/src/main/java/org/elasticsearch/common/util/FloatArray.java

@@ -23,11 +23,6 @@ public interface FloatArray extends BigArray {
      */
     float set(long index, float value);
 
-    /**
-     * Increment value at the given index by <code>inc</code> and return the value.
-     */
-    float increment(long index, float inc);
-
     /**
      * Fill slots between <code>fromIndex</code> inclusive to <code>toIndex</code> exclusive with <code>value</code>.
      */

+ 0 - 12
server/src/main/java/org/elasticsearch/common/util/concurrent/TimedRunnable.java

@@ -57,18 +57,6 @@ class TimedRunnable extends AbstractRunnable implements WrappedRunnable {
         return original instanceof AbstractRunnable && ((AbstractRunnable) original).isForceExecution();
     }
 
-    /**
-     * Return the time since this task was created until it finished running.
-     * If the task is still running or has not yet been run, returns -1.
-     */
-    long getTotalNanos() {
-        if (finishTimeNanos == -1) {
-            // There must have been an exception thrown, the total time is unknown (-1)
-            return -1;
-        }
-        return Math.max(finishTimeNanos - creationTimeNanos, 1);
-    }
-
     /**
      * Return the time this task spent being run.
      * If the task is still running or has not yet been run, returns -1.

+ 0 - 22
server/src/main/java/org/elasticsearch/common/util/iterable/Iterables.java

@@ -9,36 +9,14 @@
 package org.elasticsearch.common.util.iterable;
 
 import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Objects;
 import java.util.function.Predicate;
-import java.util.stream.Stream;
 import java.util.stream.StreamSupport;
 
 public class Iterables {
 
-    @SafeVarargs
-    @SuppressWarnings("varargs")
-    public static <T> Iterable<T> concat(Iterable<T>... inputs) {
-        Objects.requireNonNull(inputs);
-        return new ConcatenatedIterable<>(inputs);
-    }
-
-    static class ConcatenatedIterable<T> implements Iterable<T> {
-        private final Iterable<T>[] inputs;
-
-        ConcatenatedIterable(Iterable<T>[] inputs) {
-            this.inputs = Arrays.copyOf(inputs, inputs.length);
-        }
-
-        @Override
-        public Iterator<T> iterator() {
-            return Stream.of(inputs).flatMap(it -> StreamSupport.stream(it.spliterator(), false)).iterator();
-        }
-    }
-
     /** Flattens the two level {@code Iterable} into a single {@code Iterable}.  Note that this pre-caches the values from the outer {@code
      *  Iterable}, but not the values from the inner one. */
     public static <T> Iterable<T> flatten(Iterable<? extends Iterable<T>> inputs) {

+ 0 - 60
server/src/main/java/org/elasticsearch/common/xcontent/support/XContentMapValues.java

@@ -448,10 +448,6 @@ public class XContentMapValues {
         return filtered;
     }
 
-    public static boolean isObject(Object node) {
-        return node instanceof Map;
-    }
-
     public static boolean isArray(Object node) {
         return node instanceof List;
     }
@@ -473,20 +469,6 @@ public class XContentMapValues {
         return node.toString();
     }
 
-    public static float nodeFloatValue(Object node, float defaultValue) {
-        if (node == null) {
-            return defaultValue;
-        }
-        return nodeFloatValue(node);
-    }
-
-    public static float nodeFloatValue(Object node) {
-        if (node instanceof Number) {
-            return ((Number) node).floatValue();
-        }
-        return Float.parseFloat(node.toString());
-    }
-
     public static double nodeDoubleValue(Object node, double defaultValue) {
         if (node == null) {
             return defaultValue;
@@ -515,48 +497,6 @@ public class XContentMapValues {
         return nodeIntegerValue(node);
     }
 
-    public static short nodeShortValue(Object node, short defaultValue) {
-        if (node == null) {
-            return defaultValue;
-        }
-        return nodeShortValue(node);
-    }
-
-    public static short nodeShortValue(Object node) {
-        if (node instanceof Number) {
-            return Numbers.toShortExact((Number) node);
-        }
-        return Short.parseShort(node.toString());
-    }
-
-    public static byte nodeByteValue(Object node, byte defaultValue) {
-        if (node == null) {
-            return defaultValue;
-        }
-        return nodeByteValue(node);
-    }
-
-    public static byte nodeByteValue(Object node) {
-        if (node instanceof Number) {
-            return Numbers.toByteExact((Number) node);
-        }
-        return Byte.parseByte(node.toString());
-    }
-
-    public static long nodeLongValue(Object node, long defaultValue) {
-        if (node == null) {
-            return defaultValue;
-        }
-        return nodeLongValue(node);
-    }
-
-    public static long nodeLongValue(Object node) {
-        if (node instanceof Number) {
-            return Numbers.toLongExact((Number) node);
-        }
-        return Long.parseLong(node.toString());
-    }
-
     public static boolean nodeBooleanValue(Object node, String name, boolean defaultValue) {
         try {
             return nodeBooleanValue(node, defaultValue);

+ 0 - 5
server/src/main/java/org/elasticsearch/repositories/FilterRepository.java

@@ -180,11 +180,6 @@ public class FilterRepository implements Repository {
         in.addLifecycleListener(listener);
     }
 
-    @Override
-    public void removeLifecycleListener(LifecycleListener listener) {
-        in.removeLifecycleListener(listener);
-    }
-
     @Override
     public void start() {
         in.start();

+ 0 - 3
server/src/test/java/org/elasticsearch/cluster/NodeConnectionsServiceTests.java

@@ -682,9 +682,6 @@ public class NodeConnectionsServiceTests extends ESTestCase {
         @Override
         public void addLifecycleListener(LifecycleListener listener) {}
 
-        @Override
-        public void removeLifecycleListener(LifecycleListener listener) {}
-
         @Override
         public void start() {}
 

+ 0 - 5
server/src/test/java/org/elasticsearch/common/util/concurrent/EWMATrackingEsThreadPoolExecutorTests.java

@@ -111,11 +111,6 @@ public class EWMATrackingEsThreadPoolExecutorTests extends ESTestCase {
             this.testFailedOrRejected = failedOrRejected;
         }
 
-        @Override
-        public long getTotalNanos() {
-            return timeTaken;
-        }
-
         @Override
         public long getTotalExecutionNanos() {
             return timeTaken;

+ 0 - 5
server/src/test/java/org/elasticsearch/repositories/RepositoriesServiceTests.java

@@ -442,11 +442,6 @@ public class RepositoriesServiceTests extends ESTestCase {
 
         }
 
-        @Override
-        public void removeLifecycleListener(LifecycleListener listener) {
-
-        }
-
         @Override
         public void start() {
             isStarted = true;

+ 0 - 5
test/framework/src/main/java/org/elasticsearch/common/util/MockBigArrays.java

@@ -532,11 +532,6 @@ public class MockBigArrays extends BigArrays {
             return in.set(index, value);
         }
 
-        @Override
-        public float increment(long index, float inc) {
-            return in.increment(index, inc);
-        }
-
         @Override
         public void fill(long fromIndex, long toIndex, float value) {
             in.fill(fromIndex, toIndex, value);

+ 0 - 5
test/framework/src/main/java/org/elasticsearch/test/transport/StubbableTransport.java

@@ -198,11 +198,6 @@ public class StubbableTransport implements Transport {
         delegate.addLifecycleListener(listener);
     }
 
-    @Override
-    public void removeLifecycleListener(LifecycleListener listener) {
-        delegate.removeLifecycleListener(listener);
-    }
-
     @Override
     public void start() {
         delegate.start();