From d87bf836a2dadac9639a4e3c96624fabeb53f4da Mon Sep 17 00:00:00 2001 From: Martijn van Groningen Date: Tue, 2 Apr 2019 11:40:41 +0200 Subject: [PATCH] Remove -Xlint exclusions in all plugins. The xlint exclusions of the following plugins were removed: * ingest-attachment. * mapper-size. * transport-nio. Removing the -try exclusion required some work, because the NettyAdaptor implements AutoCloseable and NettyAdaptor#close() method could throw an InterruptedException (ChannelFuture#await() and a generic Exception is re-thrown, which maybe an ChannelFuture). The easiest way around this to me seemed that NettyAdaptor should not implement AutoCloseable, because it is not directly used in a try-with-resources statement. Relates to #40366 --- plugins/ingest-attachment/build.gradle | 4 ---- .../elasticsearch/ingest/attachment/AttachmentProcessor.java | 1 + plugins/mapper-size/build.gradle | 4 ---- plugins/transport-nio/build.gradle | 3 --- .../main/java/org/elasticsearch/http/nio/NettyAdaptor.java | 3 +-- 5 files changed, 2 insertions(+), 13 deletions(-) diff --git a/plugins/ingest-attachment/build.gradle b/plugins/ingest-attachment/build.gradle index 316bc850aec6d..cbe417708d778 100644 --- a/plugins/ingest-attachment/build.gradle +++ b/plugins/ingest-attachment/build.gradle @@ -68,10 +68,6 @@ dependencies { compile "org.apache.james:apache-mime4j-dom:${versions.mime4j}" } -// TODO: stop using LanguageIdentifier... -compileJava.options.compilerArgs << "-Xlint:-deprecation" - - dependencyLicenses { mapping from: /apache-mime4j-.*/, to: 'apache-mime4j' } diff --git a/plugins/ingest-attachment/src/main/java/org/elasticsearch/ingest/attachment/AttachmentProcessor.java b/plugins/ingest-attachment/src/main/java/org/elasticsearch/ingest/attachment/AttachmentProcessor.java index c8a24ad3c8719..90261de7fbe24 100644 --- a/plugins/ingest-attachment/src/main/java/org/elasticsearch/ingest/attachment/AttachmentProcessor.java +++ b/plugins/ingest-attachment/src/main/java/org/elasticsearch/ingest/attachment/AttachmentProcessor.java @@ -112,6 +112,7 @@ public IngestDocument execute(IngestDocument ingestDocument) { } if (properties.contains(Property.LANGUAGE) && Strings.hasLength(parsedContent)) { + // TODO: stop using LanguageIdentifier... LanguageIdentifier identifier = new LanguageIdentifier(parsedContent); String language = identifier.getLanguage(); additionalFields.put(Property.LANGUAGE.toLowerCase(), language); diff --git a/plugins/mapper-size/build.gradle b/plugins/mapper-size/build.gradle index 7d5aa1ee27605..5a49ce5d04b78 100644 --- a/plugins/mapper-size/build.gradle +++ b/plugins/mapper-size/build.gradle @@ -21,7 +21,3 @@ esplugin { description 'The Mapper Size plugin allows document to record their uncompressed size at index time.' classname 'org.elasticsearch.plugin.mapper.MapperSizePlugin' } - -// TODO: migrate to points -compileJava.options.compilerArgs << "-Xlint:-deprecation" -compileTestJava.options.compilerArgs << "-Xlint:-deprecation" diff --git a/plugins/transport-nio/build.gradle b/plugins/transport-nio/build.gradle index 1cc57c3833a6a..9e855995c3bfa 100644 --- a/plugins/transport-nio/build.gradle +++ b/plugins/transport-nio/build.gradle @@ -24,9 +24,6 @@ esplugin { hasClientJar = true } -compileJava.options.compilerArgs << "-Xlint:-try" -compileTestJava.options.compilerArgs << "-Xlint:-rawtypes,-unchecked" - dependencies { compile "org.elasticsearch:elasticsearch-nio:${version}" diff --git a/plugins/transport-nio/src/main/java/org/elasticsearch/http/nio/NettyAdaptor.java b/plugins/transport-nio/src/main/java/org/elasticsearch/http/nio/NettyAdaptor.java index 133206e1322d4..c221fdf1378d7 100644 --- a/plugins/transport-nio/src/main/java/org/elasticsearch/http/nio/NettyAdaptor.java +++ b/plugins/transport-nio/src/main/java/org/elasticsearch/http/nio/NettyAdaptor.java @@ -36,7 +36,7 @@ import java.util.LinkedList; import java.util.function.BiConsumer; -public class NettyAdaptor implements AutoCloseable { +class NettyAdaptor { private final EmbeddedChannel nettyChannel; private final LinkedList flushOperations = new LinkedList<>(); @@ -64,7 +64,6 @@ public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) nettyChannel.pipeline().addLast(handlers); } - @Override public void close() throws Exception { assert flushOperations.isEmpty() : "Should close outbound operations before calling close";