From fd94e35aa4e972c4cf5af08c51e1a22b4616ccb3 Mon Sep 17 00:00:00 2001 From: Ryan Ernst Date: Thu, 23 Sep 2021 16:24:50 -0700 Subject: [PATCH] Explicitly set illegal-access to deny for tests (#72588) (#78283) Since Java 16, the default value for illegal-access is deny. This means the latest release of Elasticsearch, and all current integration tests, run with deny (since we don't explicitly set it in jvm options). Yet tests run with illegal-access=warn, for legacy reasons. elastic#71908 proposed to remove the setting from test jvms, but concerns were raised there about whether this would cause some test failures. This commit explicitly sets tests to deny. This has the added benefit that any failures will be caught even when running tests with older jvms. --- .../groovy/org/elasticsearch/gradle/BuildPlugin.groovy | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy b/buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy index 7cab4e8327606..a88e41a3e6a77 100644 --- a/buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy +++ b/buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy @@ -962,7 +962,15 @@ class BuildPlugin implements Plugin { heapdumpDir.mkdirs() jvmArg '-XX:HeapDumpPath=' + heapdumpDir if (project.runtimeJavaVersion >= JavaVersion.VERSION_1_9) { - jvmArg '--illegal-access=warn' + jvmArg '--illegal-access=deny' + jvmArg '--add-opens=java.base/java.security.cert=ALL-UNNAMED' + jvmArg '--add-opens=java.base/java.nio.channels=ALL-UNNAMED' + jvmArg '--add-opens=java.base/java.net=ALL-UNNAMED' + jvmArg '--add-opens=java.base/javax.net.ssl=ALL-UNNAMED' + jvmArg '--add-opens=java.base/java.nio.file=ALL-UNNAMED' + jvmArg '--add-opens=java.base/java.time=ALL-UNNAMED' + jvmArg '--add-opens=java.base/java.lang=ALL-UNNAMED' + jvmArg '--add-opens=java.management/java.lang.management=ALL-UNNAMED' } argLine System.getProperty('tests.jvm.argline')