1
0
Эх сурвалжийг харах

Merge pull request #15848 from nik9000/xlint3

Remove -Xlint:-deprecation from all but core
Nik Everett 9 жил өмнө
parent
commit
b29c416b7c
28 өөрчлөгдсөн 110 нэмэгдсэн , 145 устгасан
  1. 2 2
      modules/lang-groovy/build.gradle
  2. 0 3
      plugins/analysis-icu/build.gradle
  3. 9 6
      plugins/analysis-icu/src/main/java/org/elasticsearch/index/analysis/IcuCollationTokenFilterFactory.java
  4. 0 2
      plugins/discovery-azure/build.gradle
  5. 0 2
      plugins/discovery-ec2/build.gradle
  6. 1 8
      plugins/discovery-ec2/src/main/java/org/elasticsearch/cloud/aws/AwsEc2Service.java
  7. 7 5
      plugins/discovery-ec2/src/main/java/org/elasticsearch/cloud/aws/AwsEc2ServiceImpl.java
  8. 7 6
      plugins/discovery-ec2/src/main/java/org/elasticsearch/plugin/discovery/ec2/Ec2DiscoveryPlugin.java
  9. 0 2
      plugins/discovery-multicast/build.gradle
  10. 24 17
      plugins/discovery-multicast/src/main/java/org/elasticsearch/plugin/discovery/multicast/MulticastZenPing.java
  11. 1 1
      plugins/mapper-attachments/build.gradle
  12. 4 1
      plugins/mapper-attachments/src/main/java/org/elasticsearch/mapper/attachments/AttachmentMapper.java
  13. 1 2
      plugins/repository-azure/build.gradle
  14. 1 4
      plugins/repository-azure/src/main/java/org/elasticsearch/cloud/azure/storage/AzureStorageService.java
  15. 28 38
      plugins/repository-azure/src/main/java/org/elasticsearch/cloud/azure/storage/AzureStorageSettings.java
  16. 1 5
      plugins/repository-azure/src/test/java/org/elasticsearch/cloud/azure/AbstractAzureRepositoryServiceTestCase.java
  17. 0 14
      plugins/repository-azure/src/test/java/org/elasticsearch/repositories/azure/AzureSettingsParserTest.java
  18. 0 2
      plugins/repository-hdfs/build.gradle
  19. 0 2
      plugins/repository-s3/build.gradle
  20. 1 8
      plugins/repository-s3/src/main/java/org/elasticsearch/cloud/aws/AwsS3Service.java
  21. 5 5
      plugins/repository-s3/src/main/java/org/elasticsearch/cloud/aws/InternalAwsS3Service.java
  22. 1 0
      plugins/repository-s3/src/main/java/org/elasticsearch/plugin/repository/s3/S3RepositoryPlugin.java
  23. 1 1
      test/framework/build.gradle
  24. 6 5
      test/framework/src/main/java/org/elasticsearch/common/io/PathUtilsForTesting.java
  25. 3 1
      test/framework/src/main/java/org/elasticsearch/test/InternalTestCluster.java
  26. 2 0
      test/framework/src/main/java/org/elasticsearch/test/disruption/LongGCDisruption.java
  27. 3 3
      test/framework/src/main/java/org/elasticsearch/test/hamcrest/ElasticsearchAssertions.java
  28. 2 0
      test/framework/src/main/java/org/elasticsearch/test/store/MockFSDirectoryService.java

+ 2 - 2
modules/lang-groovy/build.gradle

@@ -26,8 +26,8 @@ dependencies {
   compile 'org.codehaus.groovy:groovy:2.4.4:indy'
 }
 
-compileJava.options.compilerArgs << '-Xlint:-rawtypes,-unchecked,-cast,-deprecation'
-compileTestJava.options.compilerArgs << '-Xlint:-rawtypes,-unchecked,-cast,-deprecation'
+compileJava.options.compilerArgs << '-Xlint:-rawtypes,-unchecked,-cast'
+compileTestJava.options.compilerArgs << '-Xlint:-rawtypes,-unchecked,-cast'
 
 integTest {
   cluster {

+ 0 - 3
plugins/analysis-icu/build.gradle

@@ -30,6 +30,3 @@ dependencies {
 dependencyLicenses {
   mapping from: /lucene-.*/, to: 'lucene'
 }
-
-compileJava.options.compilerArgs << "-Xlint:-deprecation"
-

+ 9 - 6
plugins/analysis-icu/src/main/java/org/elasticsearch/index/analysis/IcuCollationTokenFilterFactory.java

@@ -19,18 +19,19 @@
 
 package org.elasticsearch.index.analysis;
 
-import com.ibm.icu.text.Collator;
-import com.ibm.icu.text.RuleBasedCollator;
-import com.ibm.icu.util.ULocale;
+import java.io.IOException;
+import java.nio.charset.Charset;
+import java.nio.file.Files;
+
 import org.apache.lucene.analysis.TokenStream;
 import org.elasticsearch.common.io.Streams;
 import org.elasticsearch.common.settings.Settings;
 import org.elasticsearch.env.Environment;
 import org.elasticsearch.index.IndexSettings;
 
-import java.io.IOException;
-import java.nio.charset.Charset;
-import java.nio.file.Files;
+import com.ibm.icu.text.Collator;
+import com.ibm.icu.text.RuleBasedCollator;
+import com.ibm.icu.util.ULocale;
 
 /**
  * An ICU based collation token filter. There are two ways to configure collation:
@@ -45,6 +46,7 @@ public class IcuCollationTokenFilterFactory extends AbstractTokenFilterFactory {
 
     private final Collator collator;
 
+    @SuppressWarnings("deprecation") // Intentionally sets deprecated options for backwards compatibility
     public IcuCollationTokenFilterFactory(IndexSettings indexSettings, Environment environment, String name, Settings settings) {
         super(indexSettings, name, settings);
 
@@ -165,6 +167,7 @@ public class IcuCollationTokenFilterFactory extends AbstractTokenFilterFactory {
     }
 
     @Override
+    @SuppressWarnings("deprecation") // Constructs a deprecated filter for backwards compatibility
     public TokenStream create(TokenStream tokenStream) {
         return new ICUCollationKeyFilter(tokenStream, collator);
     }

+ 0 - 2
plugins/discovery-azure/build.gradle

@@ -57,8 +57,6 @@ dependencyLicenses {
 }
 
 compileJava.options.compilerArgs << '-Xlint:-path,-serial,-unchecked'
-// TODO: why is deprecation needed here but not in maven....?
-compileJava.options.compilerArgs << '-Xlint:-deprecation'
 
 thirdPartyAudit.excludes = [
   // classes are missing

+ 0 - 2
plugins/discovery-ec2/build.gradle

@@ -42,8 +42,6 @@ dependencyLicenses {
   mapping from: /jackson-.*/, to: 'jackson'
 }
 
-compileJava.options.compilerArgs << '-Xlint:-rawtypes,-deprecation'
-
 test {
   // this is needed for insecure plugins, remove if possible!
   systemProperty 'tests.artifact', project.name 

+ 1 - 8
plugins/discovery-ec2/src/main/java/org/elasticsearch/cloud/aws/AwsEc2Service.java

@@ -20,6 +20,7 @@
 package org.elasticsearch.cloud.aws;
 
 import com.amazonaws.services.ec2.AmazonEC2;
+
 import org.elasticsearch.common.component.LifecycleComponent;
 
 public interface AwsEc2Service extends LifecycleComponent<AwsEc2Service> {
@@ -33,10 +34,6 @@ public interface AwsEc2Service extends LifecycleComponent<AwsEc2Service> {
         public static final String PROXY_PASSWORD = "cloud.aws.proxy.password";
         public static final String SIGNER = "cloud.aws.signer";
         public static final String REGION = "cloud.aws.region";
-        @Deprecated
-        public static final String DEPRECATED_PROXY_HOST = "cloud.aws.proxy_host";
-        @Deprecated
-        public static final String DEPRECATED_PROXY_PORT = "cloud.aws.proxy_port";
     }
 
     final class CLOUD_EC2 {
@@ -49,10 +46,6 @@ public interface AwsEc2Service extends LifecycleComponent<AwsEc2Service> {
         public static final String PROXY_PASSWORD = "cloud.aws.ec2.proxy.password";
         public static final String SIGNER = "cloud.aws.ec2.signer";
         public static final String ENDPOINT = "cloud.aws.ec2.endpoint";
-        @Deprecated
-        public static final String DEPRECATED_PROXY_HOST = "cloud.aws.ec2.proxy_host";
-        @Deprecated
-        public static final String DEPRECATED_PROXY_PORT = "cloud.aws.ec2.proxy_port";
     }
 
     final class DISCOVERY_EC2 {

+ 7 - 5
plugins/discovery-ec2/src/main/java/org/elasticsearch/cloud/aws/AwsEc2ServiceImpl.java

@@ -33,6 +33,7 @@ import com.amazonaws.internal.StaticCredentialsProvider;
 import com.amazonaws.retry.RetryPolicy;
 import com.amazonaws.services.ec2.AmazonEC2;
 import com.amazonaws.services.ec2.AmazonEC2Client;
+
 import org.elasticsearch.ElasticsearchException;
 import org.elasticsearch.cloud.aws.network.Ec2NameResolver;
 import org.elasticsearch.cloud.aws.node.Ec2CustomNodeAttributes;
@@ -71,6 +72,7 @@ public class AwsEc2ServiceImpl extends AbstractLifecycleComponent<AwsEc2Service>
         discoveryNodeService.addCustomAttributeProvider(new Ec2CustomNodeAttributes(settings));
     }
 
+    @Override
     public synchronized AmazonEC2 client() {
         if (client != null) {
             return client;
@@ -91,11 +93,11 @@ public class AwsEc2ServiceImpl extends AbstractLifecycleComponent<AwsEc2Service>
         String account = settings.get(CLOUD_EC2.KEY, settings.get(CLOUD_AWS.KEY));
         String key = settings.get(CLOUD_EC2.SECRET, settings.get(CLOUD_AWS.SECRET));
 
-        String proxyHost = settings.get(CLOUD_AWS.PROXY_HOST, settings.get(CLOUD_AWS.DEPRECATED_PROXY_HOST));
-        proxyHost = settings.get(CLOUD_EC2.PROXY_HOST, settings.get(CLOUD_EC2.DEPRECATED_PROXY_HOST, proxyHost));
+        String proxyHost = settings.get(CLOUD_AWS.PROXY_HOST);
+        proxyHost = settings.get(CLOUD_EC2.PROXY_HOST, proxyHost);
         if (proxyHost != null) {
-            String portString = settings.get(CLOUD_AWS.PROXY_PORT, settings.get(CLOUD_AWS.DEPRECATED_PROXY_PORT, "80"));
-            portString = settings.get(CLOUD_EC2.PROXY_PORT, settings.get(CLOUD_EC2.DEPRECATED_PROXY_PORT, portString));
+            String portString = settings.get(CLOUD_AWS.PROXY_PORT, "80");
+            portString = settings.get(CLOUD_EC2.PROXY_PORT, portString);
             Integer proxyPort;
             try {
                 proxyPort = Integer.parseInt(portString, 10);
@@ -135,7 +137,7 @@ public class AwsEc2ServiceImpl extends AbstractLifecycleComponent<AwsEc2Service>
                                                      int retriesAttempted) {
                         // with 10 retries the max delay time is 320s/320000ms (10 * 2^5 * 1 * 1000)
                         logger.warn("EC2 API request failed, retry again. Reason was:", exception);
-                        return 1000L * (long) (10d * Math.pow(2, ((double) retriesAttempted) / 2.0d) * (1.0d + rand.nextDouble()));
+                        return 1000L * (long) (10d * Math.pow(2, retriesAttempted / 2.0d) * (1.0d + rand.nextDouble()));
                     }
                 },
                 10,

+ 7 - 6
plugins/discovery-ec2/src/main/java/org/elasticsearch/plugin/discovery/ec2/Ec2DiscoveryPlugin.java

@@ -19,6 +19,11 @@
 
 package org.elasticsearch.plugin.discovery.ec2;
 
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.util.ArrayList;
+import java.util.Collection;
+
 import org.elasticsearch.SpecialPermission;
 import org.elasticsearch.cloud.aws.AwsEc2ServiceImpl;
 import org.elasticsearch.cloud.aws.Ec2Module;
@@ -32,16 +37,11 @@ import org.elasticsearch.discovery.ec2.AwsEc2UnicastHostsProvider;
 import org.elasticsearch.discovery.ec2.Ec2Discovery;
 import org.elasticsearch.plugins.Plugin;
 
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-import java.util.ArrayList;
-import java.util.Collection;
-
 /**
  *
  */
 public class Ec2DiscoveryPlugin extends Plugin {
-  
+
     // ClientConfiguration clinit has some classloader problems
     // TODO: fix that
     static {
@@ -87,6 +87,7 @@ public class Ec2DiscoveryPlugin extends Plugin {
     }
 
     @Override
+    @SuppressWarnings("rawtypes") // Supertype uses rawtype
     public Collection<Class<? extends LifecycleComponent>> nodeServices() {
         Collection<Class<? extends LifecycleComponent>> services = new ArrayList<>();
         services.add(AwsEc2ServiceImpl.class);

+ 0 - 2
plugins/discovery-multicast/build.gradle

@@ -21,5 +21,3 @@ esplugin {
   description 'The Multicast Discovery plugin allows discovery other nodes using multicast requests'
   classname 'org.elasticsearch.plugin.discovery.multicast.MulticastDiscoveryPlugin'
 }
-
-compileJava.options.compilerArgs << "-Xlint:-deprecation"

+ 24 - 17
plugins/discovery-multicast/src/main/java/org/elasticsearch/plugin/discovery/multicast/MulticastZenPing.java

@@ -19,7 +19,18 @@
 
 package org.elasticsearch.plugin.discovery.multicast;
 
-import com.carrotsearch.hppc.cursors.ObjectObjectCursor;
+import java.io.IOException;
+import java.net.InetAddress;
+import java.net.SocketAddress;
+import java.security.AccessController;
+import java.security.PrivilegedExceptionAction;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.concurrent.atomic.AtomicReference;
+
 import org.apache.lucene.util.Constants;
 import org.elasticsearch.ExceptionsHelper;
 import org.elasticsearch.SpecialPermission;
@@ -55,17 +66,7 @@ import org.elasticsearch.transport.TransportRequestHandler;
 import org.elasticsearch.transport.TransportResponse;
 import org.elasticsearch.transport.TransportService;
 
-import java.io.IOException;
-import java.net.InetAddress;
-import java.net.SocketAddress;
-import java.security.AccessController;
-import java.security.PrivilegedExceptionAction;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.atomic.AtomicInteger;
-import java.util.concurrent.atomic.AtomicReference;
+import com.carrotsearch.hppc.cursors.ObjectObjectCursor;
 
 import static org.elasticsearch.cluster.node.DiscoveryNode.readNode;
 import static org.elasticsearch.common.settings.Settings.Builder.EMPTY_SETTINGS;
@@ -144,13 +145,9 @@ public class MulticastZenPing extends AbstractLifecycleComponent<ZenPing> implem
             boolean shared = settings.getAsBoolean("discovery.zen.ping.multicast.shared", Constants.MAC_OS_X);
             // OSX does not correctly send multicasts FROM the right interface
             boolean deferToInterface = settings.getAsBoolean("discovery.zen.ping.multicast.defer_group_to_set_interface", Constants.MAC_OS_X);
-            // don't use publish address, the use case for that is e.g. a firewall or proxy and
-            // may not even be bound to an interface on this machine! use the first bound address.
-            List<InetAddress> addresses = Arrays.asList(networkService.resolveBindHostAddresses(address == null ? null : new String[] { address }));
-            NetworkUtils.sortAddresses(addresses);
 
             final MulticastChannel.Config config = new MulticastChannel.Config(port, group, bufferSize, ttl,
-                                                                               addresses.get(0), deferToInterface);
+                    getMulticastInterface(), deferToInterface);
             SecurityManager sm = System.getSecurityManager();
             if (sm != null) {
                 sm.checkPermission(new SpecialPermission());
@@ -167,6 +164,16 @@ public class MulticastZenPing extends AbstractLifecycleComponent<ZenPing> implem
         }
     }
 
+
+    @SuppressWarnings("deprecation") // Used to support funky configuration options
+    private InetAddress getMulticastInterface() throws IOException {
+        // don't use publish address, the use case for that is e.g. a firewall or proxy and
+        // may not even be bound to an interface on this machine! use the first bound address.
+        List<InetAddress> addresses = Arrays.asList(networkService.resolveBindHostAddresses(address == null ? null : new String[] { address }));
+        NetworkUtils.sortAddresses(addresses);
+        return addresses.get(0);
+    }
+
     @Override
     protected void doStop() {
         if (multicastChannel != null) {

+ 1 - 1
plugins/mapper-attachments/build.gradle

@@ -61,7 +61,7 @@ dependencies {
   compile 'org.apache.commons:commons-compress:1.10'
 }
 
-compileJava.options.compilerArgs << '-Xlint:-cast,-deprecation,-rawtypes'
+compileJava.options.compilerArgs << '-Xlint:-cast,-rawtypes'
 
 forbiddenPatterns {
   exclude '**/*.docx'

+ 4 - 1
plugins/mapper-attachments/src/main/java/org/elasticsearch/mapper/attachments/AttachmentMapper.java

@@ -100,6 +100,7 @@ public class AttachmentMapper extends FieldMapper {
             super(ref);
         }
 
+        @Override
         public AttachmentMapper.AttachmentFieldType clone() {
             return new AttachmentMapper.AttachmentFieldType(this);
         }
@@ -109,6 +110,7 @@ public class AttachmentMapper extends FieldMapper {
             return CONTENT_TYPE;
         }
 
+        @Override
         public String value(Object value) {
             return value == null?null:value.toString();
         }
@@ -292,7 +294,7 @@ public class AttachmentMapper extends FieldMapper {
                 type = "string";
             }
             Mapper.TypeParser typeParser = parserContext.typeParser(type);
-            Mapper.Builder<?, ?> mapperBuilder = typeParser.parse(propName, (Map<String, Object>) propNode, parserContext);
+            Mapper.Builder<?, ?> mapperBuilder = typeParser.parse(propName, propNode, parserContext);
 
             return mapperBuilder;
         }
@@ -414,6 +416,7 @@ public class AttachmentMapper extends FieldMapper {
     }
 
     @Override
+    @SuppressWarnings("deprecation") // https://github.com/elastic/elasticsearch/issues/15843
     public Mapper parse(ParseContext context) throws IOException {
         byte[] content = null;
         String contentType = null;

+ 1 - 2
plugins/repository-azure/build.gradle

@@ -35,6 +35,5 @@ dependencyLicenses {
   mapping from: /stax-.*/, to: 'stax'
 }
 
-compileJava.options.compilerArgs << '-Xlint:-deprecation,-serial'
-compileTestJava.options.compilerArgs << '-Xlint:-deprecation'
+compileJava.options.compilerArgs << '-Xlint:-serial'
 

+ 1 - 4
plugins/repository-azure/src/main/java/org/elasticsearch/cloud/azure/storage/AzureStorageService.java

@@ -21,6 +21,7 @@ package org.elasticsearch.cloud.azure.storage;
 
 import com.microsoft.azure.storage.LocationMode;
 import com.microsoft.azure.storage.StorageException;
+
 import org.elasticsearch.common.blobstore.BlobMetaData;
 
 import java.io.InputStream;
@@ -36,10 +37,6 @@ public interface AzureStorageService {
 
     final class Storage {
         public static final String PREFIX = "cloud.azure.storage.";
-        @Deprecated
-        public static final String ACCOUNT_DEPRECATED = "cloud.azure.storage.account";
-        @Deprecated
-        public static final String KEY_DEPRECATED = "cloud.azure.storage.key";
 
         public static final String TIMEOUT = "cloud.azure.storage.timeout";
 

+ 28 - 38
plugins/repository-azure/src/main/java/org/elasticsearch/cloud/azure/storage/AzureStorageSettings.java

@@ -82,52 +82,42 @@ public class AzureStorageSettings {
         AzureStorageSettings primaryStorage = null;
         Map<String, AzureStorageSettings> secondaryStorage = new HashMap<>();
 
-        // We check for deprecated settings
-        String account = settings.get(Storage.ACCOUNT_DEPRECATED);
-        String key = settings.get(Storage.KEY_DEPRECATED);
-
         TimeValue globalTimeout = settings.getAsTime(Storage.TIMEOUT, TimeValue.timeValueMinutes(5));
 
-        if (account != null) {
-            logger.warn("[{}] and [{}] have been deprecated. Use now [{}xxx.account] and [{}xxx.key] where xxx is any name",
-                    Storage.ACCOUNT_DEPRECATED, Storage.KEY_DEPRECATED, Storage.PREFIX, Storage.PREFIX);
-            primaryStorage = new AzureStorageSettings(null, account, key, globalTimeout);
-        } else {
-            Settings storageSettings = settings.getByPrefix(Storage.PREFIX);
-            if (storageSettings != null) {
-                Map<String, Object> asMap = storageSettings.getAsStructuredMap();
-                for (Map.Entry<String, Object> storage : asMap.entrySet()) {
-                    if (storage.getValue() instanceof Map) {
-                        @SuppressWarnings("unchecked")
-                        Map<String, String> map = (Map) storage.getValue();
-                        TimeValue timeout = TimeValue.parseTimeValue(map.get("timeout"), globalTimeout, Storage.PREFIX + storage.getKey() + ".timeout");
-                        AzureStorageSettings current = new AzureStorageSettings(storage.getKey(), map.get("account"), map.get("key"), timeout);
-                        boolean activeByDefault = Boolean.parseBoolean(map.getOrDefault("default", "false"));
-                        if (activeByDefault) {
-                            if (primaryStorage == null) {
-                                primaryStorage = current;
-                            } else {
-                                logger.warn("default storage settings has already been defined. You can not define it to [{}]", storage.getKey());
-                                secondaryStorage.put(storage.getKey(), current);
-                            }
+        Settings storageSettings = settings.getByPrefix(Storage.PREFIX);
+        if (storageSettings != null) {
+            Map<String, Object> asMap = storageSettings.getAsStructuredMap();
+            for (Map.Entry<String, Object> storage : asMap.entrySet()) {
+                if (storage.getValue() instanceof Map) {
+                    @SuppressWarnings("unchecked")
+                    Map<String, String> map = (Map) storage.getValue();
+                    TimeValue timeout = TimeValue.parseTimeValue(map.get("timeout"), globalTimeout, Storage.PREFIX + storage.getKey() + ".timeout");
+                    AzureStorageSettings current = new AzureStorageSettings(storage.getKey(), map.get("account"), map.get("key"), timeout);
+                    boolean activeByDefault = Boolean.parseBoolean(map.getOrDefault("default", "false"));
+                    if (activeByDefault) {
+                        if (primaryStorage == null) {
+                            primaryStorage = current;
                         } else {
+                            logger.warn("default storage settings has already been defined. You can not define it to [{}]", storage.getKey());
                             secondaryStorage.put(storage.getKey(), current);
                         }
+                    } else {
+                        secondaryStorage.put(storage.getKey(), current);
                     }
                 }
-                // If we did not set any default storage, we should complain and define it
-                if (primaryStorage == null && secondaryStorage.isEmpty() == false) {
-                    Map.Entry<String, AzureStorageSettings> fallback = secondaryStorage.entrySet().iterator().next();
-                    // We only warn if the number of secondary storage if > to 1
-                    // If the user defined only one storage account, that's fine. We know it's the default one.
-                    if (secondaryStorage.size() > 1) {
-                        logger.warn("no default storage settings has been defined. " +
-                                "Add \"default\": true to the settings you want to activate by default. " +
-                                "Forcing default to [{}].", fallback.getKey());
-                    }
-                    primaryStorage = fallback.getValue();
-                    secondaryStorage.remove(fallback.getKey());
+            }
+            // If we did not set any default storage, we should complain and define it
+            if (primaryStorage == null && secondaryStorage.isEmpty() == false) {
+                Map.Entry<String, AzureStorageSettings> fallback = secondaryStorage.entrySet().iterator().next();
+                // We only warn if the number of secondary storage if > to 1
+                // If the user defined only one storage account, that's fine. We know it's the default one.
+                if (secondaryStorage.size() > 1) {
+                    logger.warn("no default storage settings has been defined. " +
+                            "Add \"default\": true to the settings you want to activate by default. " +
+                            "Forcing default to [{}].", fallback.getKey());
                 }
+                primaryStorage = fallback.getValue();
+                secondaryStorage.remove(fallback.getKey());
             }
         }
 

+ 1 - 5
plugins/repository-azure/src/test/java/org/elasticsearch/cloud/azure/AbstractAzureRepositoryServiceTestCase.java

@@ -21,6 +21,7 @@ package org.elasticsearch.cloud.azure;
 
 import com.microsoft.azure.storage.LocationMode;
 import com.microsoft.azure.storage.StorageException;
+
 import org.elasticsearch.cloud.azure.storage.AzureStorageService;
 import org.elasticsearch.cloud.azure.storage.AzureStorageService.Storage;
 import org.elasticsearch.cloud.azure.storage.AzureStorageServiceMock;
@@ -79,11 +80,6 @@ public abstract class AbstractAzureRepositoryServiceTestCase extends AbstractAzu
     protected Settings nodeSettings(int nodeOrdinal) {
         Settings.Builder builder = Settings.settingsBuilder()
                 .put(Storage.CONTAINER, "snapshots");
-
-        // We use sometime deprecated settings in tests
-        builder.put(Storage.ACCOUNT_DEPRECATED, "mock_azure_account")
-                .put(Storage.KEY_DEPRECATED, "mock_azure_key");
-
         return builder.build();
     }
 

+ 0 - 14
plugins/repository-azure/src/test/java/org/elasticsearch/repositories/azure/AzureSettingsParserTest.java

@@ -20,7 +20,6 @@
 package org.elasticsearch.repositories.azure;
 
 import org.apache.lucene.util.LuceneTestCase;
-import org.elasticsearch.cloud.azure.storage.AzureStorageService.Storage;
 import org.elasticsearch.cloud.azure.storage.AzureStorageSettings;
 import org.elasticsearch.common.collect.Tuple;
 import org.elasticsearch.common.settings.Settings;
@@ -66,19 +65,6 @@ public class AzureSettingsParserTest extends LuceneTestCase {
         assertThat(tuple.v2().keySet(), hasSize(0));
     }
 
-    public void testDeprecatedSettings() {
-        Settings settings = Settings.builder()
-                .put(Storage.ACCOUNT_DEPRECATED, "myaccount1")
-                .put(Storage.KEY_DEPRECATED, "mykey1")
-                .build();
-
-        Tuple<AzureStorageSettings, Map<String, AzureStorageSettings>> tuple = AzureStorageSettings.parse(settings);
-        assertThat(tuple.v1(), notNullValue());
-        assertThat(tuple.v1().getAccount(), is("myaccount1"));
-        assertThat(tuple.v1().getKey(), is("mykey1"));
-        assertThat(tuple.v2().keySet(), hasSize(0));
-    }
-
     public void testParseTwoSettingsNoDefault() {
         Settings settings = Settings.builder()
                 .put("cloud.azure.storage.azure1.account", "myaccount1")

+ 0 - 2
plugins/repository-hdfs/build.gradle

@@ -96,8 +96,6 @@ integTest {
   }
 }
 
-compileJava.options.compilerArgs << '-Xlint:-deprecation,-rawtypes'
-
 thirdPartyAudit.excludes = [
   // classes are missing, because we added hadoop jars one by one until tests pass.
   'com.google.gson.stream.JsonReader', 

+ 0 - 2
plugins/repository-s3/build.gradle

@@ -43,8 +43,6 @@ dependencyLicenses {
   mapping from: /jackson-.*/, to: 'jackson'
 }
 
-compileJava.options.compilerArgs << '-Xlint:-deprecation,-rawtypes'
-
 test {
   // this is needed for insecure plugins, remove if possible!
   systemProperty 'tests.artifact', project.name 

+ 1 - 8
plugins/repository-s3/src/main/java/org/elasticsearch/cloud/aws/AwsS3Service.java

@@ -20,6 +20,7 @@
 package org.elasticsearch.cloud.aws;
 
 import com.amazonaws.services.s3.AmazonS3;
+
 import org.elasticsearch.common.component.LifecycleComponent;
 
 /**
@@ -37,10 +38,6 @@ public interface AwsS3Service extends LifecycleComponent<AwsS3Service> {
         public static final String PROXY_PASSWORD = "cloud.aws.proxy.password";
         public static final String SIGNER = "cloud.aws.signer";
         public static final String REGION = "cloud.aws.region";
-        @Deprecated
-        public static final String DEPRECATED_PROXY_HOST = "cloud.aws.proxy_host";
-        @Deprecated
-        public static final String DEPRECATED_PROXY_PORT = "cloud.aws.proxy_port";
     }
 
     final class CLOUD_S3 {
@@ -53,10 +50,6 @@ public interface AwsS3Service extends LifecycleComponent<AwsS3Service> {
         public static final String PROXY_PASSWORD = "cloud.aws.s3.proxy.password";
         public static final String SIGNER = "cloud.aws.s3.signer";
         public static final String ENDPOINT = "cloud.aws.s3.endpoint";
-        @Deprecated
-        public static final String DEPRECATED_PROXY_HOST = "cloud.aws.s3.proxy_host";
-        @Deprecated
-        public static final String DEPRECATED_PROXY_PORT = "cloud.aws.s3.proxy_port";
     }
 
     final class REPOSITORY_S3 {

+ 5 - 5
plugins/repository-s3/src/main/java/org/elasticsearch/cloud/aws/InternalAwsS3Service.java

@@ -31,6 +31,7 @@ import com.amazonaws.http.IdleConnectionReaper;
 import com.amazonaws.internal.StaticCredentialsProvider;
 import com.amazonaws.services.s3.AmazonS3;
 import com.amazonaws.services.s3.AmazonS3Client;
+
 import org.elasticsearch.ElasticsearchException;
 import org.elasticsearch.common.collect.Tuple;
 import org.elasticsearch.common.component.AbstractLifecycleComponent;
@@ -94,7 +95,6 @@ public class InternalAwsS3Service extends AbstractLifecycleComponent<AwsS3Servic
         return getClient(endpoint, protocol, account, key, maxRetries);
     }
 
-
     private synchronized AmazonS3 getClient(String endpoint, String protocol, String account, String key, Integer maxRetries) {
         Tuple<String, String> clientDescriptor = new Tuple<String, String>(endpoint, account);
         AmazonS3Client client = clients.get(clientDescriptor);
@@ -119,11 +119,11 @@ public class InternalAwsS3Service extends AbstractLifecycleComponent<AwsS3Servic
             throw new IllegalArgumentException("No protocol supported [" + protocol + "], can either be [http] or [https]");
         }
 
-        String proxyHost = settings.get(CLOUD_AWS.PROXY_HOST, settings.get(CLOUD_AWS.DEPRECATED_PROXY_HOST));
-        proxyHost = settings.get(CLOUD_S3.PROXY_HOST, settings.get(CLOUD_S3.DEPRECATED_PROXY_HOST, proxyHost));
+        String proxyHost = settings.get(CLOUD_AWS.PROXY_HOST);
+        proxyHost = settings.get(CLOUD_S3.PROXY_HOST, proxyHost);
         if (proxyHost != null) {
-            String portString = settings.get(CLOUD_AWS.PROXY_PORT, settings.get(CLOUD_AWS.DEPRECATED_PROXY_PORT, "80"));
-            portString = settings.get(CLOUD_S3.PROXY_PORT, settings.get(CLOUD_S3.DEPRECATED_PROXY_PORT, portString));
+            String portString = settings.get(CLOUD_AWS.PROXY_PORT, "80");
+            portString = settings.get(CLOUD_S3.PROXY_PORT, portString);
             Integer proxyPort;
             try {
                 proxyPort = Integer.parseInt(portString, 10);

+ 1 - 0
plugins/repository-s3/src/main/java/org/elasticsearch/plugin/repository/s3/S3RepositoryPlugin.java

@@ -77,6 +77,7 @@ public class S3RepositoryPlugin extends Plugin {
     }
 
     @Override
+    @SuppressWarnings("rawtypes") // Supertype declaration has raw types
     public Collection<Class<? extends LifecycleComponent>> nodeServices() {
         return Collections.<Class<? extends LifecycleComponent>>singleton(S3Module.getS3ServiceImpl());
     }

+ 1 - 1
test/framework/build.gradle

@@ -33,7 +33,7 @@ dependencies {
   compile 'org.elasticsearch:securemock:1.2'
 }
 
-compileJava.options.compilerArgs << '-Xlint:-cast,-deprecation,-rawtypes,-serial,-try,-unchecked'
+compileJava.options.compilerArgs << '-Xlint:-cast,-rawtypes,-serial,-try,-unchecked'
 compileTestJava.options.compilerArgs << '-Xlint:-rawtypes'
 
 // the main files are actually test files, so use the appopriate forbidden api sigs

+ 6 - 5
test/framework/src/main/java/org/elasticsearch/common/io/PathUtilsForTesting.java

@@ -23,21 +23,22 @@ import org.apache.lucene.util.LuceneTestCase;
 
 import java.nio.file.FileSystem;
 
-/** 
- * Exposes some package private stuff in PathUtils for framework purposes only! 
+/**
+ * Exposes some package private stuff in PathUtils for framework purposes only!
  */
 public class PathUtilsForTesting {
-    
+
     /** Sets a new default filesystem for testing */
+    @SuppressWarnings("deprecation") // https://github.com/elastic/elasticsearch/issues/15845
     public static void setup() {
         installMock(LuceneTestCase.getBaseTempDirForTestClass().getFileSystem());
     }
-    
+
     /** Installs a mock filesystem for testing */
     public static void installMock(FileSystem mock) {
         PathUtils.DEFAULT = mock;
     }
-    
+
     /** Resets filesystem back to the real system default */
     public static void teardown() {
         PathUtils.DEFAULT = PathUtils.ACTUAL_DEFAULT;

+ 3 - 1
test/framework/src/main/java/org/elasticsearch/test/InternalTestCluster.java

@@ -24,6 +24,7 @@ import com.carrotsearch.randomizedtesting.SysGlobals;
 import com.carrotsearch.randomizedtesting.generators.RandomInts;
 import com.carrotsearch.randomizedtesting.generators.RandomPicks;
 import com.carrotsearch.randomizedtesting.generators.RandomStrings;
+
 import org.apache.lucene.store.StoreRateLimiting;
 import org.apache.lucene.util.IOUtils;
 import org.elasticsearch.ElasticsearchException;
@@ -117,7 +118,6 @@ import java.util.function.Predicate;
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
 
-import static junit.framework.Assert.fail;
 import static org.apache.lucene.util.LuceneTestCase.TEST_NIGHTLY;
 import static org.apache.lucene.util.LuceneTestCase.rarely;
 import static org.elasticsearch.common.settings.Settings.settingsBuilder;
@@ -127,6 +127,7 @@ import static org.hamcrest.Matchers.equalTo;
 import static org.hamcrest.Matchers.greaterThan;
 import static org.hamcrest.Matchers.greaterThanOrEqualTo;
 import static org.junit.Assert.assertThat;
+import static org.junit.Assert.fail;
 
 /**
  * InternalTestCluster manages a set of JVM private nodes and allows convenient access to them.
@@ -1045,6 +1046,7 @@ public final class InternalTestCluster extends TestCluster {
         }
     }
 
+    @SuppressWarnings("deprecation") // https://github.com/elastic/elasticsearch/issues/15844
     private void randomlyResetClients() throws IOException {
         // only reset the clients on nightly tests, it causes heavy load...
         if (RandomizedTest.isNightly() && rarely(random)) {

+ 2 - 0
test/framework/src/main/java/org/elasticsearch/test/disruption/LongGCDisruption.java

@@ -75,6 +75,7 @@ public class LongGCDisruption extends SingleNodeDisruption {
         return TimeValue.timeValueMillis(0);
     }
 
+    @SuppressWarnings("deprecation") // stops/resumes threads intentionally
     @SuppressForbidden(reason = "stops/resumes threads intentionally")
     protected boolean stopNodeThreads(String node, Set<Thread> nodeThreads) {
         Thread[] allThreads = null;
@@ -118,6 +119,7 @@ public class LongGCDisruption extends SingleNodeDisruption {
         return stopped;
     }
 
+    @SuppressWarnings("deprecation") // stops/resumes threads intentionally
     @SuppressForbidden(reason = "stops/resumes threads intentionally")
     protected void resumeThreads(Set<Thread> threads) {
         for (Thread thread : threads) {

+ 3 - 3
test/framework/src/main/java/org/elasticsearch/test/hamcrest/ElasticsearchAssertions.java

@@ -513,9 +513,9 @@ public class ElasticsearchAssertions {
     public static <T extends Query> T assertBooleanSubQuery(Query query, Class<T> subqueryType, int i) {
         assertThat(query, instanceOf(BooleanQuery.class));
         BooleanQuery q = (BooleanQuery) query;
-        assertThat(q.getClauses().length, greaterThan(i));
-        assertThat(q.getClauses()[i].getQuery(), instanceOf(subqueryType));
-        return (T) q.getClauses()[i].getQuery();
+        assertThat(q.clauses().size(), greaterThan(i));
+        assertThat(q.clauses().get(i).getQuery(), instanceOf(subqueryType));
+        return subqueryType.cast(q.clauses().get(i).getQuery());
     }
 
     /**

+ 2 - 0
test/framework/src/main/java/org/elasticsearch/test/store/MockFSDirectoryService.java

@@ -21,6 +21,7 @@ package org.elasticsearch.test.store;
 
 import com.carrotsearch.randomizedtesting.SeedUtils;
 import com.carrotsearch.randomizedtesting.generators.RandomPicks;
+
 import org.apache.lucene.index.CheckIndex;
 import org.apache.lucene.index.IndexWriter;
 import org.apache.lucene.store.BaseDirectoryWrapper;
@@ -106,6 +107,7 @@ public class MockFSDirectoryService extends FsDirectoryService {
         throw new UnsupportedOperationException();
     }
 
+    @SuppressWarnings("deprecation") // https://github.com/elastic/elasticsearch/issues/15846
     public static void checkIndex(ESLogger logger, Store store, ShardId shardId) {
         if (store.tryIncRef()) {
             logger.info("start check index");