Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement JDK-19 Thread API #3242

Merged
merged 12 commits into from
Mar 30, 2023
22 changes: 18 additions & 4 deletions .github/workflows/run-jdk-compliance-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ jobs:
matrix:
os: [ubuntu-20.04, macos-11]
scala: [3.2.2]
java: [11, 17]
java: [11, 17, 20]
include:
- java: 20
java-options: "--enable-preview"
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/macos-setup-env
Expand All @@ -36,7 +39,12 @@ jobs:
java-version: ${{matrix.java}}

- name: Test runtime
run: sbt "++ ${{ matrix.scala }} -v" "-no-colors" "-J-Xmx3G" "test-runtime ${{matrix.scala}}"
run: >
_JAVA_OPTIONS='${{ matrix.java-options }}'
sbt
-Dscala.scalanative.multithreading.enable=true
"++ ${{ matrix.scala }} -v" "-no-colors" "-J-Xmx3G"
"test-runtime ${{matrix.scala}}"

tests-windows-jdk-compliance:
name: Test Windows JDK compliance
Expand All @@ -45,7 +53,10 @@ jobs:
fail-fast: false
matrix:
scala: [3.2.2]
java: [11, 17]
java: [11, 17, 20]
include:
- java: 20
java-options: "--enable-preview"
steps:
# Disable autocrlf setting, otherwise scalalib patches might not be possible to apply
- name: Setup git config
Expand All @@ -63,5 +74,8 @@ jobs:
set SCALANATIVE_INCLUDE_DIRS=${{steps.setup.outputs.vcpkg-dir}}\include&
set SCALANATIVE_LIB_DIRS=${{steps.setup.outputs.vcpkg-dir}}\lib&
set SCALANATIVE &
sbt ++${{matrix.scala}}
set _JAVA_OPTIONS=${{ matrix.java-options }} &
sbt
-Dscala.scalanative.multithreading.enable=true
++${{matrix.scala}}
"test-runtime ${{matrix.scala}}"
8 changes: 8 additions & 0 deletions javalib/src/main/scala/java/lang/InheritableThreadLocal.scala
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,12 @@ class InheritableThreadLocal[T <: AnyRef] extends ThreadLocal[T] {

override protected[lang] def values(current: Thread): ThreadLocal.Values =
current.inheritableThreadLocals

override protected[lang] def initializeValues(
current: Thread
): ThreadLocal.Values = {
val instance = new ThreadLocal.Values()
current.inheritableThreadLocals = instance
instance
}
}