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

Replace deprecated Unsafe API #165

Open
Horcrux7 opened this issue Mar 3, 2025 · 2 comments
Open

Replace deprecated Unsafe API #165

Horcrux7 opened this issue Mar 3, 2025 · 2 comments
Milestone

Comments

@Horcrux7
Copy link

Horcrux7 commented Mar 3, 2025

I get the follow on the console with Java 23:

WARNING: A terminally deprecated method in sun.misc.Unsafe has been called
WARNING: sun.misc.Unsafe::getLong has been called by com.kenai.jffi.UnsafeMemoryIO$UnsafeMemoryIO64 (file:.../jffi.jar)
WARNING: Please consider reporting this to the maintainers of class com.kenai.jffi.UnsafeMemoryIO$UnsafeMemoryIO64
WARNING: sun.misc.Unsafe::getLong will be removed in a future release

If I look into the source of Unsafe you should use the class VarHandle which exists since Java 9.

@headius
Copy link
Member

headius commented Mar 3, 2025

Thanks for the issue! Yes, we know we should move to Java 9 VarHandle, but since this library still supports 8 we need to be able to work both ways. Perhaps you can help with a VarHandle patch?

@headius headius added this to the 1.3.14 milestone Mar 3, 2025
@Horcrux7
Copy link
Author

Horcrux7 commented Mar 6, 2025

@headius Thanks for the very fast feedback. If you want support the out dated Java 8 in the future then a possible solution for Java 8 support and the use of VarHandle in newer Java versions can be a multi-release jar file.

Perhaps you can help with a VarHandle patch?

No, I have self never use Unsafe or VarHandle. I know that it exists. This is all. This is not a good base to write a patch.

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

No branches or pull requests

2 participants