Skip to content

Commit 21897bb

Browse files
committed
Use explicit add-opens instead of blanket illegal-access=permit
1 parent 83983d1 commit 21897bb

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

gradle/defaults-java.gradle

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,15 @@ allprojects {
7171
suspend = true
7272
}
7373

74-
jvmArgs += '--illegal-access=permit'
74+
// Since JDK 17 the default access to the following
75+
// packages is "deny". We need to open them in order
76+
// to gain access in GDS / Neo4j.
77+
jvmArgs += '--add-opens=java.base/java.lang=ALL-UNNAMED'
78+
jvmArgs += '--add-opens=java.base/java.lang.invoke=ALL-UNNAMED'
79+
jvmArgs += '--add-opens=java.base/java.nio=ALL-UNNAMED'
80+
jvmArgs += '--add-opens=java.base/java.util.stream=ALL-UNNAMED'
81+
jvmArgs += '--add-opens=java.base/sun.net.www.protocol.http=ALL-UNNAMED'
82+
7583
maxHeapSize = "3G"
7684
useJUnitPlatform {
7785
includeEngines 'junit-jupiter'
@@ -94,7 +102,16 @@ allprojects {
94102
targetCompatibility = JavaVersion.VERSION_11
95103
options.warnings = true
96104
options.encoding = 'UTF-8'
97-
options.forkOptions.jvmArgs += '--illegal-access=permit'
105+
106+
// Since JDK 17 the default access to the following
107+
// packages is "deny". We need to open them in order
108+
// to gain access in GDS / Neo4j.
109+
options.forkOptions.jvmArgs += '--add-opens=java.base/java.lang=ALL-UNNAMED'
110+
options.forkOptions.jvmArgs += '--add-opens=java.base/java.lang.invoke=ALL-UNNAMED'
111+
options.forkOptions.jvmArgs += '--add-opens=java.base/java.nio=ALL-UNNAMED'
112+
options.forkOptions.jvmArgs += '--add-opens=java.base/java.util.stream=ALL-UNNAMED'
113+
options.forkOptions.jvmArgs += '--add-opens=java.base/sun.net.www.protocol.http=ALL-UNNAMED'
114+
98115
options.compilerArgs += [
99116
'-parameters',
100117
'-Xlint:all,-cast,-deprecation,-processing,-serial,-try,-unchecked,-varargs',

0 commit comments

Comments
 (0)