RFR: 8318966: Some methods make promises about Java array element alignment that are too strong

Chen Liang liach at openjdk.org
Tue Jan 23 14:46:39 UTC 2024


On Thu, 16 Nov 2023 18:10:28 GMT, Jorn Vernee <jvernee at openjdk.org> wrote:

>> src/java.base/share/classes/java/lang/invoke/MethodHandles.java line 4518:
>> 
>>> 4516:      * Only plain {@linkplain VarHandle.AccessMode#GET get} and {@linkplain VarHandle.AccessMode#SET set}
>>> 4517:      * access modes are supported by the returned var handle. For all other access modes, an
>>> 4518:      * {@link UnsupportedOperationException} will be thrown.
>> 
>> I recommend adding an api note explaining that native memory segments, direct byte buffers, or heap memory segments backed by long[] should be used if support for other access modes are required.
>
> Good idea. Thanks

Should we make these unaligned access modes throw ISE like before, when the given index is unaligned?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/16681#discussion_r1463367572


More information about the nio-dev mailing list