-
CSR
-
Resolution: Approved
-
P4
-
None
-
behavioral
-
minimal
-
-
Java API
-
SE
Summary
Correct the JavaDocs for MemoryLayout.JAVA_LONG
and MemoryLayout.JAVA_DOUBLE
to reflect the fact they always have an alignment of 8 bytes regardless if running on a 32-bit or a 64-bit system.
Problem
Previously, the alignment for these value layouts was specified to be the same as for the ADDRESS
(which is different in 32-bit (4) and 64-bit systems (8)). A fix (https://bugs.openjdk.org/browse/JDK-8326172) was made that changed the alignment of these value layouts but, unfortunately, the API documentation was not updated to reflect these changes.
Solution
Correct the JavaDocs for said fields.
Specification
diff --git a/src/java.base/share/classes/java/lang/foreign/ValueLayout.java b/src/java.base/share/classes/java/lang/foreign/ValueLayout.java
index 77bfe0e0209b..d4e396534911 100644
--- a/src/java.base/share/classes/java/lang/foreign/ValueLayout.java
+++ b/src/java.base/share/classes/java/lang/foreign/ValueLayout.java
@@ -446,8 +446,7 @@ sealed interface OfDouble extends ValueLayout permits ValueLayouts.OfDoubleImpl
/**
* A value layout constant whose size is the same as that of a Java {@code long},
- * (platform-dependent) byte alignment set to {@code ADDRESS.byteSize()},
- * and byte order set to {@link ByteOrder#nativeOrder()}.
+ * byte alignment set to 8, and byte order set to {@link ByteOrder#nativeOrder()}.
*/
OfLong JAVA_LONG = ValueLayouts.OfLongImpl.of(ByteOrder.nativeOrder());
@@ -459,8 +458,7 @@ sealed interface OfDouble extends ValueLayout permits ValueLayouts.OfDoubleImpl
/**
* A value layout constant whose size is the same as that of a Java {@code double},
- * (platform-dependent) byte alignment set to {@code ADDRESS.byteSize()},
- * and byte order set to {@link ByteOrder#nativeOrder()}.
+ * byte alignment set to 8, and byte order set to {@link ByteOrder#nativeOrder()}.
*/
OfDouble JAVA_DOUBLE = ValueLayouts.OfDoubleImpl.of(ByteOrder.nativeOrder());
- csr of
-
JDK-8330272 Wrong javadoc for ValueLayout.JAVA_LONG/JAVA_DOUBLE on x86 32bit
-
- Resolved
-