diff --git a/client/build.gradle b/client/build.gradle index 2c82fd74569..c947f94ff26 100644 --- a/client/build.gradle +++ b/client/build.gradle @@ -53,10 +53,11 @@ forbiddenApisMain { //excludes don't seem to work though and we don't want to have our own @SuppressForbidden forbiddenApisTest.enabled=false -//forbiddenApisTest { +forbiddenApisTest { //client does not depend on core, so only jdk signatures should be checked - //signaturesURLs = [PrecommitTasks.getResource('/forbidden/jdk-signatures.txt')] -//} + signaturesURLs = [PrecommitTasks.getResource('/forbidden/jdk-signatures.txt')] + suppressAnnotations = ['**.SuppressForbidden'] +} //JarHell is part of es core, which we don't want to pull in jarHell.enabled=false diff --git a/client/src/test/java/org/elasticsearch/client/RestClientIntegTests.java b/client/src/test/java/org/elasticsearch/client/RestClientIntegTests.java index 4dadfc1a918..1505ccd55d2 100644 --- a/client/src/test/java/org/elasticsearch/client/RestClientIntegTests.java +++ b/client/src/test/java/org/elasticsearch/client/RestClientIntegTests.java @@ -56,6 +56,7 @@ import static org.hamcrest.CoreMatchers.equalTo; * Integration test to check interaction between {@link RestClient} and {@link org.apache.http.client.HttpClient}. * Works against a real http server, one single host. */ +@SuppressForbidden(reason = "uses sun HttpServer") public class RestClientIntegTests extends LuceneTestCase { private static HttpServer httpServer; diff --git a/client/src/test/java/org/elasticsearch/client/SuppressForbidden.java b/client/src/test/java/org/elasticsearch/client/SuppressForbidden.java new file mode 100644 index 00000000000..309cc666bc4 --- /dev/null +++ b/client/src/test/java/org/elasticsearch/client/SuppressForbidden.java @@ -0,0 +1,34 @@ +/* + * Licensed to Elasticsearch under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch 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.elasticsearch.client; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * Annotation to suppress forbidden-apis errors inside a whole class, a method, or a field. + */ +@Retention(RetentionPolicy.CLASS) +@Target({ ElementType.CONSTRUCTOR, ElementType.FIELD, ElementType.METHOD, ElementType.TYPE }) +public @interface SuppressForbidden { + String reason(); +} \ No newline at end of file