Skip to content

Warning of use of Unsafe in JDK 23 #362

@Thihup

Description

@Thihup
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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions