Skip to content

Commit c7d09ad

Browse files
committed
Update javadocs after comments
1 parent ebb5b30 commit c7d09ad

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

src/java.base/share/classes/java/lang/foreign/MemorySegment.java

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
package java.lang.foreign;
2828

2929
import java.io.UncheckedIOException;
30+
import java.lang.ref.Cleaner;
3031
import java.lang.reflect.Array;
3132
import java.lang.invoke.MethodHandles;
3233
import java.nio.Buffer;
@@ -1118,7 +1119,7 @@ static MemorySegment ofAddress(long address, long byteSize, MemorySession sessio
11181119
* <p>
11191120
* Clients are responsible for ensuring that the memory session associated with the returned segment is
11201121
* closed when segments are no longer in use. Failure to do so will result in off-heap memory leaks. As an
1121-
* alternative to explicitly invoke {@link MemorySession#close()}, sessions backed with a Cleaner
1122+
* alternative to explicitly invoke {@link MemorySession#close()}, sessions backed with a {@link Cleaner}
11221123
* (such as {@linkplain MemorySession#openImplicit()}) can be used, allowing the returned segment to be
11231124
* automatically released some unspecified time after the session is no longer referenced.
11241125
* <p>
@@ -1137,8 +1138,7 @@ static MemorySegment ofAddress(long address, long byteSize, MemorySession sessio
11371138
* @param session the session to which the returned segment is associated.
11381139
* @return a new native segment.
11391140
* @throws IllegalStateException if the {@code session} is not {@linkplain MemorySession#isAlive() alive}.
1140-
* @throws WrongThreadException if this method is invoked by a thread other than the
1141-
* {@linkplain MemorySession#ownerThread() owner thread} (if any).
1141+
* @throws WrongThreadException if this method is called from a thread other than the thread owning {@code session}.
11421142
* @see MemorySession#allocate(MemoryLayout)
11431143
*/
11441144
static MemorySegment allocateNative(MemoryLayout layout, MemorySession session) {
@@ -1151,7 +1151,7 @@ static MemorySegment allocateNative(MemoryLayout layout, MemorySession session)
11511151
* <p>
11521152
* Clients are responsible for ensuring that the memory session associated with the returned segment is
11531153
* closed when segments are no longer in use. Failure to do so will result in off-heap memory leaks. As an
1154-
* alternative to explicitly invoke {@link MemorySession#close()}, sessions backed with a Cleaner
1154+
* alternative to explicitly invoke {@link MemorySession#close()}, sessions backed with a {@link Cleaner}
11551155
* (such as {@linkplain MemorySession#openImplicit()}) can be used, allowing the returned segment to be
11561156
* automatically released some unspecified time after the session is no longer referenced.
11571157
* <p>
@@ -1173,8 +1173,7 @@ static MemorySegment allocateNative(MemoryLayout layout, MemorySession session)
11731173
* @return a new native memory segment.
11741174
* @throws IllegalArgumentException if {@code byteSize < 0}.
11751175
* @throws IllegalStateException if the {@code session} is not {@linkplain MemorySession#isAlive() alive}.
1176-
* @throws WrongThreadException if this method is invoked by a thread other than the
1177-
* {@linkplain MemorySession#ownerThread() owner thread} (if any).
1176+
* @throws WrongThreadException if this method is called from a thread other than the thread owning {@code session}.
11781177
* @see ByteBuffer#allocateDirect(int)
11791178
* @see MemorySession#allocate(long)
11801179
*/
@@ -1188,7 +1187,7 @@ static MemorySegment allocateNative(long byteSize, MemorySession session) {
11881187
* <p>
11891188
* Clients are responsible for ensuring that the memory session associated with the returned segment is
11901189
* closed when segments are no longer in use. Failure to do so will result in off-heap memory leaks. As an
1191-
* alternative to explicitly invoke {@link MemorySession#close()}, sessions backed with a Cleaner
1190+
* alternative to explicitly invoke {@link MemorySession#close()}, sessions backed with a {@link Cleaner}
11921191
* (such as {@linkplain MemorySession#openImplicit()}) can be used, allowing the returned segment to be
11931192
* automatically released some unspecified time after the session is no longer referenced.
11941193
* <p>
@@ -1214,8 +1213,7 @@ static MemorySegment allocateNative(long byteSize, MemorySession session) {
12141213
* @throws IllegalArgumentException if {@code byteSize < 0}, {@code byteAlignment <= 0}, or if {@code byteAlignment}
12151214
* is not a power of 2.
12161215
* @throws IllegalStateException if the {@code session} is not {@linkplain MemorySession#isAlive() alive}.
1217-
* @throws WrongThreadException if this method is invoked by a thread other than the
1218-
* {@linkplain MemorySession#ownerThread() owner thread} (if any).
1216+
* @throws WrongThreadException if this method is called from a thread other than the thread owning {@code session}.
12191217
* @see MemorySession#allocate(long, long)
12201218
*/
12211219
static MemorySegment allocateNative(long byteSize, long byteAlignment, MemorySession session) {

src/java.base/share/classes/java/lang/foreign/package-info.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
* and fill it with values ranging from {@code 0} to {@code 9}, we can use the following code:
4343
*
4444
* {@snippet lang=java :
45-
* MemorySegment segment = MemorySegment.allocateNative(10 * 4, session);
45+
* MemorySegment segment = MemorySegment.allocateNative(10 * 4, MemorySession.openImplicit());
4646
* for (int i = 0 ; i < 10 ; i++) {
4747
* segment.setAtIndex(ValueLayout.JAVA_INT, i, i);
4848
* }

0 commit comments

Comments
 (0)