Skip to content

Commit fd94e35

Browse files
authored
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. #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.
1 parent 7089fc6 commit fd94e35

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -962,7 +962,15 @@ class BuildPlugin implements Plugin<Project> {
962962
heapdumpDir.mkdirs()
963963
jvmArg '-XX:HeapDumpPath=' + heapdumpDir
964964
if (project.runtimeJavaVersion >= JavaVersion.VERSION_1_9) {
965-
jvmArg '--illegal-access=warn'
965+
jvmArg '--illegal-access=deny'
966+
jvmArg '--add-opens=java.base/java.security.cert=ALL-UNNAMED'
967+
jvmArg '--add-opens=java.base/java.nio.channels=ALL-UNNAMED'
968+
jvmArg '--add-opens=java.base/java.net=ALL-UNNAMED'
969+
jvmArg '--add-opens=java.base/javax.net.ssl=ALL-UNNAMED'
970+
jvmArg '--add-opens=java.base/java.nio.file=ALL-UNNAMED'
971+
jvmArg '--add-opens=java.base/java.time=ALL-UNNAMED'
972+
jvmArg '--add-opens=java.base/java.lang=ALL-UNNAMED'
973+
jvmArg '--add-opens=java.management/java.lang.management=ALL-UNNAMED'
966974
}
967975
argLine System.getProperty('tests.jvm.argline')
968976

0 commit comments

Comments
 (0)