Skip to content

Commit ba9ee8c

Browse files
committedJun 3, 2022
8287748: Fix issues in java.lang.foreign package javadoc
Reviewed-by: jvernee
1 parent deb0653 commit ba9ee8c

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed
 

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

+6-5
Original file line numberDiff line numberDiff line change
@@ -106,15 +106,16 @@
106106
* we can use the following code:
107107
*
108108
* {@snippet lang=java :
109-
* var linker = Linker.nativeLinker();
109+
* Linker linker = Linker.nativeLinker();
110+
* SymbolLookup stdlib = linker.defaultLookup();
110111
* MethodHandle strlen = linker.downcallHandle(
111-
* linker.lookup("strlen").get(),
112+
* stdlib.lookup("strlen").get(),
112113
* FunctionDescriptor.of(ValueLayout.JAVA_LONG, ValueLayout.ADDRESS)
113114
* );
114115
*
115-
* try (var session = MemorySession.openConfined()) {
116-
* var cString = MemorySegment.allocateNative(5 + 1, session);
117-
* cString.setUtf8String("Hello");
116+
* try (MemorySession session = MemorySession.openConfined()) {
117+
* MemorySegment cString = MemorySegment.allocateNative(5 + 1, session);
118+
* cString.setUtf8String(0, "Hello");
118119
* long len = (long)strlen.invoke(cString); // 5
119120
* }
120121
* }

0 commit comments

Comments
 (0)
Please sign in to comment.