forked from monix/monix
-
Notifications
You must be signed in to change notification settings - Fork 0
JDK 25 compatibility: Drop JDK 8 support, JCTools 4.x, VarHandle fencing, CI modernization #6
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
Open
halotukozak
wants to merge
19
commits into
bump-dependencies
Choose a base branch
from
jdk-25-compat
base: bump-dependencies
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
5dd55a7
docs(04-jdk-25-compatibility): create phase plan
halotukozak 52e2c5c
feat(04-01): upgrade JCTools from 3.3.0 to 4.0.5
halotukozak ebd052c
docs(04-01): complete JCTools 4.0.5 upgrade plan
halotukozak c59f3fc
feat(04-02): modernize CI workflow with JDK 25 matrix and updated act…
halotukozak 78e5e2b
docs(04-02): complete CI workflow modernization plan
halotukozak 0812a90
chore: remove .planning from git tracking
halotukozak 1ea0392
fix(04-03): replace sun.misc.Unsafe.fullFence() with VarHandle.fullFe…
halotukozak ad39a82
fix(04-02): add sbt via setup-java cache parameter
halotukozak 347beea
fix(04-02): trigger CI on all pull requests
halotukozak 0103de1
fix(04-02): install sbt via sbt/setup-sbt@v1
halotukozak aa912bb
chore: comment out flaky test for Semaphore behavior (typelevel/cats-…
halotukozak d56e20c
chore: remove JDK 8 from CI build matrix
halotukozak 0fca646
fix: replace `Thread.getId` with `Thread.threadId` for improved compa…
halotukozak 9d4a7e5
Revert "fix: replace `Thread.getId` with `Thread.threadId` for improv…
halotukozak cf9c5d8
chore: suppress deprecation warnings with `@nowarn` in thread factory…
halotukozak 8596db3
chore: update CI build matrix to use Java 11 instead of Java 8
halotukozak 1bd4711
chore: implement `ThreadCompat` to bridge `Thread.getId` and `Thread.…
halotukozak 6ef4cbf
chore: add Mima filters for `avs` changes
halotukozak 59f282b
chore: replace `getId` with `threadIdCompat` in `currentThreadId` for…
halotukozak File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
monix-execution/jvm/src/main/scala/monix/execution/internal/ThreadCompat.scala
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| /* | ||
| * Copyright (c) 2014-2021 by The Monix Project Developers. | ||
| * See the project homepage at: https://monix.io | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| package monix.execution.internal | ||
|
|
||
| import java.lang.invoke.{MethodHandle, MethodHandles, MethodType} | ||
|
|
||
| //todo: remove when JDK < 19 support dropped | ||
| private[monix] object ThreadCompat { | ||
| private val ThreadIdHandle: MethodHandle = | ||
| try | ||
| // JDK >= 19 | ||
| MethodHandles.lookup.findVirtual(classOf[Thread], "threadId", MethodType.methodType(classOf[Long])) | ||
| catch { | ||
| case _: NoSuchMethodException | _: IllegalAccessException => | ||
| try | ||
| // JDK < 19 | ||
| MethodHandles.lookup.findVirtual(classOf[Thread], "getId", MethodType.methodType(classOf[Long])) | ||
| catch { | ||
| case ex: Exception => | ||
| throw new RuntimeException(ex) | ||
| } | ||
| } | ||
|
|
||
| implicit final class ThreadCompatOps(private val thread: Thread) extends AnyVal { | ||
| def threadIdCompat: Long = ThreadIdHandle.invokeExact(thread).asInstanceOf[Long] | ||
| } | ||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if I like this approach. Both methods still exist on JDK 25 and migration to
threadIdis trivial - I think we can stick with the deprecated method for now and switch tothreadIdwhen dropping support for JDK < 19. This way we'll avoid ugly reflection.