Skip to content

Commit

Permalink
Open up java.base/java.lang to use withEnvironment() with JDK17+ (#4100)
Browse files Browse the repository at this point in the history
Fixes #2849
  • Loading branch information
OliverO2 committed Jun 14, 2024
1 parent a6ebf70 commit 34ddec0
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions documentation/docs/extensions/system.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,14 @@ test("foo") {
```

:::info
To use `withEnvironment` with JDK17+ you need to add `--add-opens=java.base/java.util=ALL-UNNAMED` to the arguments for the JVM that runs the tests.
To use `withEnvironment` with JDK17+ you need to add `--add-opens=java.base/java.util=ALL-UNNAMED`
and `--add-opens=java.base/java.lang=ALL-UNNAMED` to the arguments for the JVM that runs the tests.

If you run tests with gradle, you can add the following to your `build.gradle.kts`:

```kotlin
tasks.withType<Test>().configureEach {
jvmArgs("--add-opens=java.base/java.util=ALL-UNNAMED")
jvmArgs("--add-opens=java.base/java.util=ALL-UNNAMED", "--add-opens=java.base/java.lang=ALL-UNNAMED")
}
```
:::
Expand Down
2 changes: 1 addition & 1 deletion kotest-extensions/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,5 @@ kotlin {
}

tasks.withType<Test>().configureEach {
jvmArgs("--add-opens=java.base/java.util=ALL-UNNAMED")
jvmArgs("--add-opens=java.base/java.util=ALL-UNNAMED", "--add-opens=java.base/java.lang=ALL-UNNAMED")
}
2 changes: 1 addition & 1 deletion kotest-framework/kotest-framework-engine/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,5 @@ kotlin {
}

tasks.withType<Test>().configureEach {
jvmArgs("--add-opens=java.base/java.util=ALL-UNNAMED")
jvmArgs("--add-opens=java.base/java.util=ALL-UNNAMED", "--add-opens=java.base/java.lang=ALL-UNNAMED")
}

0 comments on commit 34ddec0

Please sign in to comment.