Release Note: Deprecated sun.misc.Unsafe Methods That Return Offsets

XMLWordPrintable

    • Verified

      Developers that use the unsupported `sun.misc.Unsafe` API should be aware that the methods that return base and field offsets have been deprecated in this release. The methods `objectFieldOffset`, `staticFieldOffset`, and `staticFieldBase` methods are an
      impediment to future changes. A future release will eventually degrade or remove these methods along with the heap accessor methods.

      The `java.lang.invoke.VarHandle` API (added in Java 9) provides a strongly typed reference to a variable that is safe and a replacement to many cases that use field offsets and the heap accessor methods. It is strongly recommended to migrate to the `VarHandle` API where possible. Multi-Release JARs can be used by libraries and frameworks that continue to support JDK 8 or older.

            Assignee:
            Alan Bateman
            Reporter:
            Alan Bateman
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: