RFR: 8361300: Document exceptions for Unsafe offset methods [v7]

Chen Liang liach at openjdk.org
Fri Aug 8 17:20:31 UTC 2025


On Fri, 1 Aug 2025 16:16:01 GMT, Chen Liang <liach at openjdk.org> wrote:

>> 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 incrementally with one additional commit since the last revision:
> 
>   Test update advised by volkan

Thanks for the reviews.

As a final note, I decide to keep the in C++ unsafe checks for now; the unsafe.cpp seems to indicate there are more contracts that I cannot verify right now, for things like offset conversions. So I will integrate this patch as-is.

-------------

PR Comment: https://git.openjdk.org/jdk/pull/25945#issuecomment-3168776977


More information about the core-libs-dev mailing list