Skip to content

Commit 1a8771e

Browse files
committed
Add JDK11 support without enabling in CI (#31644)
* Upgrade bouncycastle Required to fix `bcprov-jdk15on-1.55.jar; invalid manifest format ` on jdk 11 * Downgrade bouncycastle to avoid invalid manifest * Add checksum for new jars * Update tika permissions for jdk 11 * Mute test failing on jdk 11 * Add JDK11 to CI * Thread#stop(Throwable) was removed http://mail.openjdk.java.net/pipermail/core-libs-dev/2018-June/053536.html * Disable failing tests #31456 * Temprorarily disable doc tests To see if there are other failures on JDK11 * Only blacklist specific doc tests * Disable only failing tests in ingest attachment plugin * Mute failing HDFS tests #31498 * Mute failing lang-painless tests #31500 * Fix backwards compatability builds Fix JAVA version to 10 for ES 6.3 * Add 6.x to bwx -> java10 * Prefix out and err from buildBwcVersion for readability ``` > Task :distribution:bwc:next-bugfix-snapshot:buildBwcVersion [bwc] :buildSrc:compileJava [bwc] WARNING: An illegal reflective access operation has occurred [bwc] WARNING: Illegal reflective access by org.codehaus.groovy.reflection.CachedClass (file:/home/alpar/.gradle/wrapper/dists/gradle-4.5-all/cg9lyzfg3iwv6fa00os9gcgj4/gradle-4.5/lib/groovy-all-2.4.12.jar) to method java.lang.Object.finalize() [bwc] WARNING: Please consider reporting this to the maintainers of org.codehaus.groovy.reflection.CachedClass [bwc] WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations [bwc] WARNING: All illegal access operations will be denied in a future release [bwc] :buildSrc:compileGroovy [bwc] :buildSrc:writeVersionProperties [bwc] :buildSrc:processResources [bwc] :buildSrc:classes [bwc] :buildSrc:jar ``` * Also set RUNTIME_JAVA_HOME for bwcBuild So that we can make sure it's not too new for the build to understand. * Align bouncycastle dependency * fix painles array tets closes #31500 * Update jar checksums * Keep 8/10 runtime/compile untill consensus builds on 11 * Only skip failing tests if running on Java 11 * Failures are dependent of compile java version not runtime * Condition doc test exceptions on compiler java version as well * Disable hdfs tests based on runtime java * Set runtime java to minimum supported for bwc * PR review * Add comment with ticket for forbidden apis
1 parent 6d17e91 commit 1a8771e

File tree

21 files changed

+105
-26
lines changed

21 files changed

+105
-26
lines changed

buildSrc/src/main/resources/forbidden/jdk-signatures.txt

+2-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,8 @@ java.lang.Thread#getAllStackTraces()
8888

8989
@defaultMessage Stopping threads explicitly leads to inconsistent states. Use interrupt() instead.
9090
java.lang.Thread#stop()
91-
java.lang.Thread#stop(java.lang.Throwable)
91+
# uncomment when https://github.com/elastic/elasticsearch/issues/31715 is fixed
92+
# java.lang.Thread#stop(java.lang.Throwable)
9293

9394
@defaultMessage Please do not terminate the application
9495
java.lang.System#exit(int)

distribution/bwc/build.gradle

+34-2
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,14 @@
1818
*/
1919

2020

21+
2122
import org.apache.tools.ant.taskdefs.condition.Os
2223
import org.elasticsearch.gradle.LoggedExec
2324
import org.elasticsearch.gradle.Version
2425

25-
import static org.elasticsearch.gradle.BuildPlugin.getJavaHome
26+
import java.nio.charset.StandardCharsets
2627

28+
import static org.elasticsearch.gradle.BuildPlugin.getJavaHome
2729
/**
2830
* This is a dummy project which does a local checkout of the previous
2931
* version's branch, and builds a snapshot. This allows backcompat
@@ -147,12 +149,16 @@ subprojects {
147149

148150
task buildBwcVersion(type: Exec) {
149151
dependsOn checkoutBwcBranch, writeBuildMetadata
152+
// send RUNTIME_JAVA_HOME so the build doesn't fails on newer version the branch doesn't know about
153+
environment('RUNTIME_JAVA_HOME', getJavaHome(it, rootProject.ext.minimumRuntimeVersion.getMajorVersion() as int))
150154
workingDir = checkoutDir
155+
// we are building branches that are officially built with JDK 8, push JAVA8_HOME to JAVA_HOME for these builds
151156
if (["5.6", "6.0", "6.1"].contains(bwcBranch)) {
152-
// we are building branches that are officially built with JDK 8, push JAVA8_HOME to JAVA_HOME for these builds
153157
environment('JAVA_HOME', getJavaHome(it, 8))
154158
} else if ("6.2".equals(bwcBranch)) {
155159
environment('JAVA_HOME', getJavaHome(it, 9))
160+
} else if (["6.3", "6.x"].contains(bwcBranch)) {
161+
environment('JAVA_HOME', getJavaHome(it, 10))
156162
} else {
157163
environment('JAVA_HOME', project.compilerJavaHome)
158164
}
@@ -177,6 +183,8 @@ subprojects {
177183
} else if (showStacktraceName.equals("ALWAYS_FULL")) {
178184
args "--full-stacktrace"
179185
}
186+
standardOutput = new IndentingOutputStream(System.out)
187+
errorOutput = new IndentingOutputStream(System.err)
180188
doLast {
181189
List missing = artifactFiles.grep { file ->
182190
false == file.exists()
@@ -196,3 +204,27 @@ subprojects {
196204
}
197205
}
198206
}
207+
208+
class IndentingOutputStream extends OutputStream {
209+
210+
public static final byte[] INDENT = " [bwc] ".getBytes(StandardCharsets.UTF_8)
211+
private final OutputStream delegate
212+
213+
public IndentingOutputStream(OutputStream delegate) {
214+
this.delegate = delegate
215+
}
216+
217+
@Override
218+
public void write(int b) {
219+
write([b] as int[], 0, 1)
220+
}
221+
222+
public void write(int[] bytes, int offset, int length) {
223+
for (int i = 0; i < bytes.length; i++) {
224+
delegate.write(bytes[i])
225+
if (bytes[i] == '\n') {
226+
delegate.write(INDENT)
227+
}
228+
}
229+
}
230+
}

docs/build.gradle

+9
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,15 @@ integTestCluster {
3939
setting 'reindex.remote.whitelist', '127.0.0.1:*'
4040
}
4141

42+
// remove when https://github.com/elastic/elasticsearch/issues/31305 is fixed
43+
if (rootProject.ext.compilerJavaVersion.isJava11()) {
44+
integTestRunner {
45+
systemProperty 'tests.rest.blacklist', [
46+
'plugins/ingest-attachment/line_164',
47+
'plugins/ingest-attachment/line_117'
48+
].join(',')
49+
}
50+
}
4251
// Build the cluster with all plugins
4352

4453
project.rootProject.subprojects.findAll { it.parent.path == ':plugins' }.each { subproj ->

modules/lang-painless/src/test/java/org/elasticsearch/painless/ArrayTests.java

+6-1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
package org.elasticsearch.painless;
2121

2222
import org.apache.lucene.util.Constants;
23+
import org.elasticsearch.bootstrap.JavaVersion;
2324
import org.hamcrest.Matcher;
2425

2526
import java.lang.invoke.MethodHandle;
@@ -41,7 +42,11 @@ protected String valueCtorCall(String valueType, int size) {
4142

4243
@Override
4344
protected Matcher<String> outOfBoundsExceptionMessageMatcher(int index, int size) {
44-
return equalTo(Integer.toString(index));
45+
if (JavaVersion.current().compareTo(JavaVersion.parse("11")) < 0) {
46+
return equalTo(Integer.toString(index));
47+
} else{
48+
return equalTo("Index " + Integer.toString(index) + " out of bounds for length " + Integer.toString(size));
49+
}
4550
}
4651

4752
public void testArrayLengthHelper() throws Throwable {

plugins/ingest-attachment/build.gradle

+11-1
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,21 @@ esplugin {
2525
versions << [
2626
'tika': '1.18',
2727
'pdfbox': '2.0.9',
28-
'bouncycastle': '1.55',
28+
'bouncycastle': '1.59',
2929
'poi': '3.17',
3030
'mime4j': '0.8.1'
3131
]
3232

33+
if (rootProject.ext.compilerJavaVersion.isJava11()) {
34+
// disabled until https://github.com/elastic/elasticsearch/issues/31456 is fixed.
35+
integTestRunner {
36+
systemProperty 'tests.rest.blacklist', [
37+
'ingest_attachment/20_attachment_processor/Test indexed chars are configurable',
38+
'ingest_attachment/20_attachment_processor/Test indexed chars are configurable per document'
39+
].join(',')
40+
}
41+
}
42+
3343
dependencies {
3444
// mandatory for tika
3545
compile "org.apache.tika:tika-core:${versions.tika}"

plugins/ingest-attachment/licenses/bcmail-jdk15on-1.55.jar.sha1

-1
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
db389ade95f48592908a84e7050a691c8834723c

plugins/ingest-attachment/licenses/bcpkix-jdk15on-1.55.jar.sha1

-1
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
9cef0aab8a4bb849a8476c058ce3ff302aba3fff

plugins/ingest-attachment/licenses/bcprov-jdk15on-1.55.jar.sha1

-1
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2507204241ab450456bdb8e8c0a8f986e418bd99

plugins/ingest-attachment/src/main/java/org/elasticsearch/ingest/attachment/TikaImpl.java

+5-6
Original file line numberDiff line numberDiff line change
@@ -164,12 +164,11 @@ static PermissionCollection getRestrictedPermissions() {
164164
perms.add(new RuntimePermission("getClassLoader"));
165165
// ZipFile needs accessDeclaredMembers on JDK 10; cf. https://bugs.openjdk.java.net/browse/JDK-8187485
166166
if (JavaVersion.current().compareTo(JavaVersion.parse("10")) >= 0) {
167-
/*
168-
* See if this permission can be removed in JDK 11, bump the version here to 12 if not. If this permission can be removed, also
169-
* remove the grant in the plugin-security.policy.
170-
*/
171-
assert JavaVersion.current().compareTo(JavaVersion.parse("11")) < 0;
172-
perms.add(new RuntimePermission("accessDeclaredMembers"));
167+
if (JavaVersion.current().compareTo(JavaVersion.parse("11")) < 0) {
168+
// TODO remove this and from plugin-security.policy when JDK 11 is the only one we support
169+
// this is needed pre 11, but it's fixed in 11 : https://bugs.openjdk.java.net/browse/JDK-8187485
170+
perms.add(new RuntimePermission("accessDeclaredMembers"));
171+
}
173172
}
174173
perms.setReadOnly();
175174
return perms;

plugins/ingest-attachment/src/test/java/org/elasticsearch/ingest/attachment/AttachmentProcessorTests.java

+2
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222
import org.apache.commons.io.IOUtils;
2323
import org.elasticsearch.ElasticsearchParseException;
24+
import org.elasticsearch.bootstrap.JavaVersion;
2425
import org.elasticsearch.ingest.IngestDocument;
2526
import org.elasticsearch.ingest.Processor;
2627
import org.elasticsearch.ingest.RandomDocumentPicks;
@@ -296,6 +297,7 @@ private Map<String, Object> parseDocument(String file, AttachmentProcessor proce
296297
}
297298

298299
public void testIndexedChars() throws Exception {
300+
assumeFalse("https://github.com/elastic/elasticsearch/issues/31305", JavaVersion.current().equals(JavaVersion.parse("11")));
299301
processor = new AttachmentProcessor(randomAlphaOfLength(10), "source_field",
300302
"target_field", EnumSet.allOf(AttachmentProcessor.Property.class), 19, false, null);
301303

plugins/repository-hdfs/build.gradle

+20-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*
1+
1/*
22
* Licensed to Elasticsearch under one or more contributor
33
* license agreements. See the NOTICE file distributed with
44
* this work for additional information regarding copyright
@@ -215,6 +215,25 @@ RestIntegTestTask integTestSecureHa = project.tasks.create('integTestSecureHa',
215215
description = "Runs rest tests against an elasticsearch cluster with HDFS configured with HA Namenode and secured by MIT Kerberos."
216216
}
217217

218+
if (rootProject.ext.compilerJavaVersion.isJava11()) {
219+
// TODO remove when: https://github.com/elastic/elasticsearch/issues/31498
220+
integTestRunner {
221+
systemProperty 'tests.rest.blacklist', [
222+
'hdfs_repository/30_snapshot/take snapshot',
223+
'hdfs_repository/40_restore/Create a snapshot and then restore it',
224+
'hdfs_repository/20_repository_verify/HDFS Repository Verify',
225+
'hdfs_repository/30_snapshot_get/Get a snapshot',
226+
'hdfs_repository/20_repository_create/HDFS Repository Creation',
227+
'hdfs_repository/20_repository_delete/HDFS Delete Repository',
228+
'hdfs_repository/30_snapshot_readonly/Get a snapshot - readonly',
229+
].join(',')
230+
}
231+
}
232+
if (rootProject.ext.runtimeJavaVersion.isJava11()) {
233+
// TODO remove when: https://github.com/elastic/elasticsearch/issues/31498
234+
integTestHa.enabled = false
235+
}
236+
218237
// Determine HDFS Fixture compatibility for the current build environment.
219238
boolean fixtureSupported = false
220239
if (Os.isFamily(Os.FAMILY_WINDOWS)) {

plugins/repository-hdfs/src/test/java/org/elasticsearch/repositories/hdfs/HdfsTests.java

+7-5
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,11 @@
1818
*/
1919
package org.elasticsearch.repositories.hdfs;
2020

21-
import static org.hamcrest.Matchers.equalTo;
22-
import static org.hamcrest.Matchers.greaterThan;
23-
24-
import java.util.Collection;
25-
2621
import com.carrotsearch.randomizedtesting.annotations.ThreadLeakFilters;
2722
import org.elasticsearch.action.admin.cluster.repositories.put.PutRepositoryResponse;
2823
import org.elasticsearch.action.admin.cluster.snapshots.create.CreateSnapshotResponse;
2924
import org.elasticsearch.action.admin.cluster.snapshots.restore.RestoreSnapshotResponse;
25+
import org.elasticsearch.bootstrap.JavaVersion;
3026
import org.elasticsearch.client.Client;
3127
import org.elasticsearch.cluster.ClusterState;
3228
import org.elasticsearch.common.settings.Settings;
@@ -35,6 +31,11 @@
3531
import org.elasticsearch.snapshots.SnapshotState;
3632
import org.elasticsearch.test.ESSingleNodeTestCase;
3733

34+
import java.util.Collection;
35+
36+
import static org.hamcrest.Matchers.equalTo;
37+
import static org.hamcrest.Matchers.greaterThan;
38+
3839
@ThreadLeakFilters(filters = {HdfsClientThreadLeakFilter.class})
3940
public class HdfsTests extends ESSingleNodeTestCase {
4041

@@ -44,6 +45,7 @@ protected Collection<Class<? extends Plugin>> getPlugins() {
4445
}
4546

4647
public void testSimpleWorkflow() {
48+
assumeFalse("https://github.com/elastic/elasticsearch/issues/31498", JavaVersion.current().equals(JavaVersion.parse("11")));
4749
Client client = client();
4850

4951
PutRepositoryResponse putRepositoryResponse = client.admin().cluster().preparePutRepository("test-repo")

x-pack/plugin/core/build.gradle

+2-2
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ dependencies {
3535

3636
// security deps
3737
compile 'com.unboundid:unboundid-ldapsdk:3.2.0'
38-
compile 'org.bouncycastle:bcprov-jdk15on:1.58'
39-
compile 'org.bouncycastle:bcpkix-jdk15on:1.58'
38+
compile 'org.bouncycastle:bcprov-jdk15on:1.59'
39+
compile 'org.bouncycastle:bcpkix-jdk15on:1.59'
4040
compile project(path: ':modules:transport-netty4', configuration: 'runtime')
4141

4242
testCompile 'org.elasticsearch:securemock:1.2'

x-pack/plugin/core/licenses/bcpkix-jdk15on-1.58.jar.sha1

-1
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
9cef0aab8a4bb849a8476c058ce3ff302aba3fff

x-pack/plugin/core/licenses/bcprov-jdk15on-1.58.jar.sha1

-1
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2507204241ab450456bdb8e8c0a8f986e418bd99

x-pack/plugin/security/build.gradle

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ dependencies {
2121
testCompile project(path: xpackModule('core'), configuration: 'testArtifacts')
2222

2323
compile 'com.unboundid:unboundid-ldapsdk:3.2.0'
24-
compile 'org.bouncycastle:bcprov-jdk15on:1.58'
25-
compile 'org.bouncycastle:bcpkix-jdk15on:1.58'
24+
compile 'org.bouncycastle:bcprov-jdk15on:1.59'
25+
compile 'org.bouncycastle:bcpkix-jdk15on:1.59'
2626

2727
// the following are all SAML dependencies - might as well download the whole internet
2828
compile "org.opensaml:opensaml-core:3.3.0"

0 commit comments

Comments
 (0)