fix: add replacement for deprecated methods in sun.misc.Unsafe#1661
Merged
fix: add replacement for deprecated methods in sun.misc.Unsafe#1661
Conversation
Test Results 56 files + 4 56 suites +4 2m 26s ⏱️ -17s Results for commit c31c23f. ± Comparison against base commit eba28eb. This pull request removes 31 and adds 73 tests. Note that renamed tests count towards both.♻️ This comment has been updated with latest results. |
0utplay
approved these changes
Jun 18, 2025
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Motivation
All methods that are performing memory-access operations in sun.misc.Unsafe have been deprecated for removal in jdk 24. There are safe replacements available, however, as CloudNet supports (some) very old libraries we need that these methods stay available to support these old library versions.
Modification
Add a replacement for deprecated methods in sun.misc.Unsafe that are (partly) using safe replacements in an unsafe way. While the performance of the replacement will not be as good as the performance of sun.misc.Unsafe and some very spcial (and undocumented) method invocations might not be possible anymore, it at least ensures that most old libraries can still run on new jdk versions.
Result
Old libraries that are using deprecated methods from sun.misc.Unsafe will use a "safe" implementation (possibly slower) instead. This ensures that old libraries can continue to work on newer jdk versions.