Skip to content

Remove unsed Unsafe::objectFieldOffset usage in JvmUtils#178

Merged
electrum merged 1 commit intoairlift:masterfrom
electrum:unsafe
Jun 13, 2025
Merged

Remove unsed Unsafe::objectFieldOffset usage in JvmUtils#178
electrum merged 1 commit intoairlift:masterfrom
electrum:unsafe

Conversation

@electrum
Copy link
Member

Prevent warnings when running on newer JDKs:

WARNING: A terminally deprecated method in sun.misc.Unsafe has been called
WARNING: sun.misc.Unsafe::objectFieldOffset has been called by io.airlift.slice.JvmUtils (file:/Users/xxx/.m2/repository/io/airlift/slice/2.3/slice-2.3.jar)
WARNING: Please consider reporting this to the maintainers of class io.airlift.slice.JvmUtils
WARNING: sun.misc.Unsafe::objectFieldOffset will be removed in a future release

@electrum electrum requested a review from Copilot June 13, 2025 00:17
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR removes the deprecated Unsafe.objectFieldOffset usage and the related bufferAddress method to eliminate warnings on newer JDKs.

  • Deleted Buffer import and the bufferAddress method
  • Removed ADDRESS_OFFSET field and its reflective initialization
  • Cleaned up now-unused checkArgument import
Comments suppressed due to low confidence (1)

src/main/java/io/airlift/slice/JvmUtils.java:18

  • The import 'java.lang.reflect.Field' is now unused after removing reflection-based address offset code; consider deleting it to clean up imports.
import java.lang.reflect.Field;

@electrum electrum merged commit 20874bb into airlift:master Jun 13, 2025
2 checks passed
@electrum electrum deleted the unsafe branch June 13, 2025 00:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants