[foreign-memaccess+abi] RFR: Clarify javadoc w.r.t. exceptions thrown by a memory access var handle

Maurizio Cimadamore mcimadamore at openjdk.org
Fri Aug 18 15:44:03 UTC 2023


On Fri, 18 Aug 2023 15:36:49 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

> We do not state very clearly which exceptions can occur when calling a memory segment var handle.
> This patch rectifies that.

src/java.base/share/classes/java/lang/foreign/MemoryLayout.java line 265:

> 263:  * Alternatively, a memory access operation is <em>partially aligned</em> if it occurs at a memory address {@code A}
> 264:  * which is only compatible with the alignment constraint {@code B}; in such cases, access for anything other than the
> 265:  * {@code get} and {@code set} access modes will result in an {@code IllegalArgumentException}. If access is partially aligned,

I believe this and the following have always been "wrong" - e.g. ISE instead of IAE (which is what the code throws)

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

PR Review Comment: https://git.openjdk.org/panama-foreign/pull/869#discussion_r1298594964


More information about the panama-dev mailing list