RFR: 8361300: Document exceptions for Unsafe offset methods [v5]
Chen Liang
liach at openjdk.org
Thu Jul 31 18:39:20 UTC 2025
> Unsafe throws IAE for misusing static vs instance fields, and it's revealed that AtomicXxxFieldUpdaters are using this mechanism to reject static fields. This is not a good practice, but we can at least document this so we don't accidentally introduce problems.
Chen Liang 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 eight additional commits since the last revision:
- Move exception to Java code, stress the field must be known
- Merge branch 'master' of https://github.com/openjdk/jdk into doc/unsafe-field-offset
- Test to verify observed internal unsafe behaviors
- Add tck coverage
- Explicit static checks
- Simplify
- Add static check
- Document IAE for Unsafe offset methods
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/25945/files
- new: https://git.openjdk.org/jdk/pull/25945/files/57f863b7..71584eb3
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=25945&range=04
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=25945&range=03-04
Stats: 67725 lines in 1877 files changed: 38128 ins; 19192 del; 10405 mod
Patch: https://git.openjdk.org/jdk/pull/25945.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/25945/head:pull/25945
PR: https://git.openjdk.org/jdk/pull/25945
More information about the core-libs-dev
mailing list