RFR: 8277863: Deprecate sun.misc.Unsafe methods that return offsets [v2]
Alan Bateman
alanb at openjdk.java.net
Mon Dec 6 18:19:39 UTC 2021
> Deprecate the sun.misc.Unsafe methods that return field offsets. These method are an impediment to possible future changes. Layout may not be fixed in the future, the VM should be allowed to re-layout dynamically based on patterns of usage. We also have the issue of libraries using these methods to get offsets (sometimes of classes with the same layout as JDK classes) so they can directly access the fields of privileged classes. It's untenable for libraries to rely on this going forward.
>
> The java.lang.invoke.VarHandle API (added in Java 9) provides a strongly typed reference to a variable that is a safe and a much better alternative to many cases that use these methods. Deprecating these method provides a gentle nudge in that directory. Once the Panama memory APIs are permanent then we can look at terminally deprecating and removing these methods, along with the accessors.
Alan Bateman has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains three additional commits since the last revision:
- Add staticFieldBase to the list
- Merge
- Initial commit
-------------
Changes:
- all: https://git.openjdk.java.net/jdk/pull/6700/files
- new: https://git.openjdk.java.net/jdk/pull/6700/files/794c6160..40bb5e7e
Webrevs:
- full: https://webrevs.openjdk.java.net/?repo=jdk&pr=6700&range=01
- incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=6700&range=00-01
Stats: 5387 lines in 366 files changed: 3786 ins; 549 del; 1052 mod
Patch: https://git.openjdk.java.net/jdk/pull/6700.diff
Fetch: git fetch https://git.openjdk.java.net/jdk pull/6700/head:pull/6700
PR: https://git.openjdk.java.net/jdk/pull/6700
More information about the core-libs-dev
mailing list