On Sun, 6 Jul 2025 18:32:56 GMT, ExE Boss <d...@openjdk.org> wrote: >> Chen Liang has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Test to verify observed internal unsafe behaviors > > test/jdk/jdk/internal/misc/Unsafe/AddressComputationContractTest.java line 91: > >> 89: assertDoesNotThrow(() -> >> getUnsafe().arrayBaseOffset(int[].class)); >> 90: assertThrows(NullPointerException.class, () -> >> getUnsafe().arrayBaseOffset(null)); >> 91: // Caused by VM trying to throw java.lang.InvalidClassException >> (there's one in java.io instead) > > Note that the one in `java.io` is also a checked exception (extends > `java.io.ObjectStreamException` which extends `java.io.IOException`).
Yes, but there has been precedent of some sort of code throwing checked exceptions in a potentially-unchecked context, such as the lookup getter in proxy classes throw IllegalAccessException instead of IllegalAccessError. Anyways, an java.io exception is definitely not suitable here. When sun.misc.Unsafe memory access methods are gone, we might simply change this to an IAE instead. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25945#discussion_r2188630344