Hello dev.java team!
Thanks again for all the excellent content. I am filing a ticket to report some typos and a broken link that I found while reviewing the "The Foreign Function and Memory API " tutorial ( https://dev.java/learn/ffm/ ) in case the team is interested to fix these items.
In the latest version of https://dev.java/learn/ffm/upcall/ (archived as is at https://web.archive.org/web/20260712004940/https://dev.java/learn/ffm/upcall/ )
-
In the sentence
nbemb represents the number of elements in the array,
"nbemb" should be "nmemb" (to be consistent with the code sample above it and make sense as "number of members")
-
In the sentence
Let's start with how to represent in Java the method that compares two elements, in this case two int values::
"values::" should be "values:"
-
In the sentence
The Linker.upcallStub(MethodHandle,FunctionDescriptor,Arena,Linker.Option...) method needs three arguments:
"Linker.upcallStub(MethodHandle,FunctionDescriptor,Arena,Linker.Option...)" link has the wrong fragment for the method causing it not to scroll to the intended method on the javadoc page, linking to https://docs.oracle.com/en/java/javase/26/docs/api/java.base/java/lang/foreign/Linker.html#upcallStub(java.lang.invoke.MethodHandle,java.lang.foreign.FunctionDescriptor,java.lang.foreign.MemorySession) ,
when, to be consistent with the link text and the actual method available, it should link to https://docs.oracle.com/en/java/javase/26/docs/api/java.base/java/lang/foreign/Linker.html#upcallStub(java.lang.invoke.MethodHandle,java.lang.foreign.FunctionDescriptor,java.lang.foreign.Arena,java.lang.foreign.Linker.Option...) .
In the latest version of https://dev.java/learn/ffm/troubleshoot/ (archived as is at https://web.archive.org/web/20260712045513/https://dev.java/learn/ffm/troubleshoot/ ) ,
-
In the code snippet
// Convert errno code to a string message:
String errrorString = ((MemorySegment) strerror.invokeExact(errno))
.reinterpret(Long.MAX_VALUE).getString(0);
IO.println("errno string: " + errrorString);
"errrorString" should be "errorString" (3 'r's should be 2 'r's). (in two places in the code)
-
The Method Restriction reason table methods are not hyperlinked to their javadocs, which is inconsistent with elsewhere in these tutorials (and less useful than if hyperlinked)
-
In the Method Restriction reason table, it may be useful to double check the two columns for a single row
Linker.upcallStub(MethodHandle, FunctionDescriptor, Arena, Linker.Option...)
When you create downcall handles, the linker can't check whether the function pointer you are creating is the correct one for the for the downcall you are passing it to.
It seems the above may be potentially mismatched as the method is "Linker.upcallStub" but the description is explaining why downcall handles are restricted.
In the latest version of https://dev.java/learn/ffm/access-memory/ (archived as is at https://web.archive.org/web/20260711215115/https://dev.java/learn/ffm/access-memory/ )
In the latest version of https://dev.java/learn/ffm/jextract/ (archived as is at https://web.archive.org/web/20260712045824/https://dev.java/learn/ffm/jextract/ )
In the latest version of https://dev.java/learn/ffm/access-structure/ (archived as is at https://web.archive.org/web/20260711043546/https://dev.java/learn/ffm/access-structure/ )
Thanks very much!
Hello dev.java team!
Thanks again for all the excellent content. I am filing a ticket to report some typos and a broken link that I found while reviewing the "The Foreign Function and Memory API " tutorial ( https://dev.java/learn/ffm/ ) in case the team is interested to fix these items.
In the latest version of https://dev.java/learn/ffm/upcall/ (archived as is at https://web.archive.org/web/20260712004940/https://dev.java/learn/ffm/upcall/ )
In the sentence
"nbemb" should be "nmemb" (to be consistent with the code sample above it and make sense as "number of members")
In the sentence
"values::" should be "values:"
In the sentence
"Linker.upcallStub(MethodHandle,FunctionDescriptor,Arena,Linker.Option...)" link has the wrong fragment for the method causing it not to scroll to the intended method on the javadoc page, linking to https://docs.oracle.com/en/java/javase/26/docs/api/java.base/java/lang/foreign/Linker.html#upcallStub(java.lang.invoke.MethodHandle,java.lang.foreign.FunctionDescriptor,java.lang.foreign.MemorySession) ,
when, to be consistent with the link text and the actual method available, it should link to https://docs.oracle.com/en/java/javase/26/docs/api/java.base/java/lang/foreign/Linker.html#upcallStub(java.lang.invoke.MethodHandle,java.lang.foreign.FunctionDescriptor,java.lang.foreign.Arena,java.lang.foreign.Linker.Option...) .
In the latest version of https://dev.java/learn/ffm/troubleshoot/ (archived as is at https://web.archive.org/web/20260712045513/https://dev.java/learn/ffm/troubleshoot/ ) ,
In the code snippet
"errrorString" should be "errorString" (3 'r's should be 2 'r's). (in two places in the code)
The Method Restriction reason table methods are not hyperlinked to their javadocs, which is inconsistent with elsewhere in these tutorials (and less useful than if hyperlinked)
In the Method Restriction reason table, it may be useful to double check the two columns for a single row
It seems the above may be potentially mismatched as the method is "Linker.upcallStub" but the description is explaining why downcall handles are restricted.
In the latest version of https://dev.java/learn/ffm/access-memory/ (archived as is at https://web.archive.org/web/20260711215115/https://dev.java/learn/ffm/access-memory/ )
In the sentence
"has as main trait:" is ungrammatical. Maybe this was intended to be "has a main trait:"?
Also should it be "The global arena" instead of "A global arena"? In the Java documentation,
they consistently use "The global arena", e.g. at https://docs.oracle.com/en/java/javase/26/docs/api/java.base/java/lang/foreign/Arena.html
or at the Javadoc for https://docs.oracle.com/en/java/javase/26/docs/api/java.base/java/lang/foreign/Arena.html#global() :
In the latest version of https://dev.java/learn/ffm/jextract/ (archived as is at https://web.archive.org/web/20260712045824/https://dev.java/learn/ffm/jextract/ )
In the sentence
"you might not be need all the" should be "you might not need all the" (remove "be").
In the latest version of https://dev.java/learn/ffm/access-structure/ (archived as is at https://web.archive.org/web/20260711043546/https://dev.java/learn/ffm/access-structure/ )
In the sentence
"that are more efficiently to initialize" should be "that are more efficient to initialize".
In the sentence
"obtain" should be "obtaining"..
Thanks very much!