x-stream / xstream

Serialize Java objects to XML and back again.
http://x-stream.github.io
Other
749 stars 227 forks source link

Warning of use of Unsafe in JDK 23 #362

Open Thihup opened 5 months ago

Thihup commented 5 months ago
WARNING: A terminally deprecated method in sun.misc.Unsafe has been called
WARNING: sun.misc.Unsafe::objectFieldOffset has been called by com.thoughtworks.xstream.converters.reflection.SunUnsafeReflectionProvider (file:/xstream-1.4.20.jar)
WARNING: Please consider reporting this to the maintainers of class com.thoughtworks.xstream.converters.reflection.SunUnsafeReflectionProvider
WARNING: sun.misc.Unsafe::objectFieldOffset will be removed in a future release

When running with --sun-misc-unsafe-memory-access=deny (the default in the future):

java.lang.ExceptionInInitializerError
        at xstream@1.4.20/com.thoughtworks.xstream.core.util.CompositeClassLoader.<clinit>(CompositeClassLoader.java:56)
        at xstream@1.4.20/com.thoughtworks.xstream.XStream.<init>(XStream.java:403)
        at xstream@1.4.20/com.thoughtworks.xstream.XStream.<init>(XStream.java:377)
Caused by: java.lang.UnsupportedOperationException: objectFieldOffset
        at jdk.unsupported/sun.misc.Unsafe.beforeMemoryAccessSlow(Unsafe.java:1826)
        at jdk.unsupported/sun.misc.Unsafe.beforeMemoryAccess(Unsafe.java:1791)
        at jdk.unsupported/sun.misc.Unsafe.objectFieldOffset(Unsafe.java:909)
        at xstream@1.4.20/com.thoughtworks.xstream.converters.reflection.SunUnsafeReflectionProvider.getFieldOffset(SunUnsafeReflectionProvider.java:105)
        at xstream@1.4.20/com.thoughtworks.xstream.converters.reflection.SunUnsafeReflectionProvider.write(SunUnsafeReflectionProvider.java:66)
        at xstream@1.4.20/com.thoughtworks.xstream.converters.reflection.SunUnsafeReflectionProvider.writeField(SunUnsafeReflectionProvider.java:56)
        at xstream@1.4.20/com.thoughtworks.xstream.core.JVM.<clinit>(JVM.java:100)
        ... 30 more

Related: https://openjdk.org/jeps/471