Quality Outreach Heads-up - Java Array Element Alignment: Weakening of Some Methods Guarantees ?David Delabassee on February 6, 2024
The OpenJDK Quality Group is promoting the testing of FOSS projects with OpenJDK builds as a way to improve the overall quality of the release. This heads-up is part of a regular communication sent to the projects involved. To learn more about the program, and how-to join, please check here.
Java Array Element Alignment: Weakening of Some Methods Guarantees ?
Some methods make promises about Java array element alignment that are too strong. There are some ongoing reflexions to change the implementation (and the specification) of
ByteBuffer::alignmentOffset to weaken the guarantees they make about the alignment of Java array elements, in order to bring them in line with the guarantees made by an arbitrary JVM implementation.
MethodHandles::byteArrayViewVarHandlewould only support
setmethods, and all other access methods would throw an exception.
MethodHandles::byteBufferViewHandlewould only support the
setaccess methods when a heap buffer is used, and all other access methods would throw an exception when used with a heap buffer. Direct byte buffers will continue to work the same way.
ByteBuffer::alignedSlicemethods would throw an exception if the buffer is a heap buffer, and the given
unitSizeis greater than 1.