Repository navigation
eliminate sun.misc.Unsafe package dependency - #1055
Open
ChristThePhone wants to merge 2 commits into
Open
ChristThePhone wants to merge 2 commits into
ChristThePhone wants to merge 2 commits into
Conversation
added 2 commits
December 3, 2026 13:57
relax Java 11 timing assertion
Author
|
All runs used a fresh sbt cache, so the tests actually ran: 18 of 18 suites passed, with
|
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.
In order to address #1046 with the help of AI :
sun.misc.Unsafeand the other JDK-internal APIs (sun.nio.ch.DirectBuffer, reflection intoDirectByteBuffer) are gone from the code../sbt testpasses for both modules, including the performance-vs-v6 assertions inMessageUnpackerTest. I only ran on JDK 21. The build targets Java 8, so I used only Java 8 APIs, but I didn't run it on JDK 8.MessageBufferis now a singleByteBuffer-backed class. It stores a big-endian slice and uses absoluteget/putfor primitives. For array-backed buffers, bulk copies go throughSystem.arraycopy. Direct buffers use aduplicate()view, so a shared buffer's position and limit are never changed.I deleted
MessageBufferU,MessageBufferBE,DirectBufferAccessandDirectBufferAccessTest. With no Unsafe path left, the universal and big-endian variants had no purpose.Behavior changes:
MessageBufferUandMessageBufferBEwere public classes, so code that referenced them will no longer compile.MessageBuffer.releaseBuffer(): it is kept but deprecated, and it now does nothing. It used to free direct-buffer memory throughUnsafe.invokeCleaner, so direct memory is now freed only by the garbage collector.wrap(ByteBuffer)still rejects them withIllegalArgumentException, becauseByteStringTestdepends on that.sliceAsByteBuffer(): the result is now a true slice, with position 0 and anarrayOffsetfor array-backed buffers. Before, it was awrapwith a non-zero position. The existing tests didn't need changes for this.Other edits:
--add-openstest JVM options and the!sun.*OSGi import frombuild.sbt.msgpack.universal-bufferCI step fromCI.yml.--add-openssection fromREADME.mdand updatedCLAUDE.md. I leftRELEASE_NOTES.mdalone, since those entries are historical.universalconditionals fromMessageBufferTest,MessageUnpackerTestandByteStringTest, so direct buffers are always tested. I also renamed the "unsafe" benchmark labels.