Skip to content

Commit 36c148e

Browse files
committed
Remove animal sniffer from low-level REST client (#29646)
The low-level REST client targets JDK 7. To avoid compiling against JDK functionality not available in JDK 7, we use animal sniffer. However, when we switched to using the JDK 9 and now the JDK 10 compiler which has built-in support for targeting previous JDKs, we no longer need to use animal sniffer. This is because the JDK is now packaged with the signatures needed to ensure that when we target JDK 7 at compile-time it is detected that we are only using JDK 7 functionality. This commit removes the use of animal sniffer from the low-level REST client build.
1 parent fbcff2f commit 36c148e

File tree

4 files changed

+0
-18
lines changed

4 files changed

+0
-18
lines changed

client/rest/build.gradle

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
import org.elasticsearch.gradle.precommit.PrecommitTasks
2121

2222
apply plugin: 'elasticsearch.build'
23-
apply plugin: 'ru.vyarus.animalsniffer'
2423
apply plugin: 'nebula.maven-base-publish'
2524
apply plugin: 'nebula.maven-scm'
2625

@@ -52,8 +51,6 @@ dependencies {
5251
testCompile "org.hamcrest:hamcrest-all:${versions.hamcrest}"
5352
testCompile "org.elasticsearch:securemock:${versions.securemock}"
5453
testCompile "org.elasticsearch:mocksocket:${versions.mocksocket}"
55-
testCompile "org.codehaus.mojo:animal-sniffer-annotations:1.15"
56-
signature "org.codehaus.mojo.signature:java17:1.0@signature"
5754
}
5855

5956
forbiddenApisMain {

client/rest/src/test/java/org/elasticsearch/client/RestClientBuilderIntegTests.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
import com.sun.net.httpserver.HttpsConfigurator;
2525
import com.sun.net.httpserver.HttpsServer;
2626
import org.apache.http.HttpHost;
27-
import org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement;
2827
import org.elasticsearch.mocksocket.MockHttpServer;
2928
import org.junit.AfterClass;
3029
import org.junit.BeforeClass;
@@ -46,8 +45,6 @@
4645
/**
4746
* Integration test to validate the builder builds a client with the correct configuration
4847
*/
49-
//animal-sniffer doesn't like our usage of com.sun.net.httpserver.* classes
50-
@IgnoreJRERequirement
5148
public class RestClientBuilderIntegTests extends RestClientTestCase {
5249

5350
private static HttpsServer httpsServer;
@@ -60,8 +57,6 @@ public static void startHttpServer() throws Exception {
6057
httpsServer.start();
6158
}
6259

63-
//animal-sniffer doesn't like our usage of com.sun.net.httpserver.* classes
64-
@IgnoreJRERequirement
6560
private static class ResponseHandler implements HttpHandler {
6661
@Override
6762
public void handle(HttpExchange httpExchange) throws IOException {

client/rest/src/test/java/org/elasticsearch/client/RestClientMultipleHostsIntegTests.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
import com.sun.net.httpserver.HttpHandler;
2424
import com.sun.net.httpserver.HttpServer;
2525
import org.apache.http.HttpHost;
26-
import org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement;
2726
import org.elasticsearch.mocksocket.MockHttpServer;
2827
import org.junit.AfterClass;
2928
import org.junit.Before;
@@ -48,8 +47,6 @@
4847
* Integration test to check interaction between {@link RestClient} and {@link org.apache.http.client.HttpClient}.
4948
* Works against real http servers, multiple hosts. Also tests failover by randomly shutting down hosts.
5049
*/
51-
//animal-sniffer doesn't like our usage of com.sun.net.httpserver.* classes
52-
@IgnoreJRERequirement
5350
public class RestClientMultipleHostsIntegTests extends RestClientTestCase {
5451

5552
private static HttpServer[] httpServers;
@@ -90,8 +87,6 @@ private static HttpServer createHttpServer() throws Exception {
9087
return httpServer;
9188
}
9289

93-
//animal-sniffer doesn't like our usage of com.sun.net.httpserver.* classes
94-
@IgnoreJRERequirement
9590
private static class ResponseHandler implements HttpHandler {
9691
private final int statusCode;
9792

client/rest/src/test/java/org/elasticsearch/client/RestClientSingleHostIntegTests.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
import org.apache.http.impl.client.BasicCredentialsProvider;
3434
import org.apache.http.impl.nio.client.HttpAsyncClientBuilder;
3535
import org.apache.http.util.EntityUtils;
36-
import org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement;
3736
import org.elasticsearch.mocksocket.MockHttpServer;
3837
import org.junit.AfterClass;
3938
import org.junit.BeforeClass;
@@ -64,8 +63,6 @@
6463
* Integration test to check interaction between {@link RestClient} and {@link org.apache.http.client.HttpClient}.
6564
* Works against a real http server, one single host.
6665
*/
67-
//animal-sniffer doesn't like our usage of com.sun.net.httpserver.* classes
68-
@IgnoreJRERequirement
6966
public class RestClientSingleHostIntegTests extends RestClientTestCase {
7067

7168
private static HttpServer httpServer;
@@ -91,8 +88,6 @@ private static HttpServer createHttpServer() throws Exception {
9188
return httpServer;
9289
}
9390

94-
//animal-sniffer doesn't like our usage of com.sun.net.httpserver.* classes
95-
@IgnoreJRERequirement
9691
private static class ResponseHandler implements HttpHandler {
9792
private final int statusCode;
9893

0 commit comments

Comments
 (0)