Skip to content

Typos and a bad hyperlink in "The Foreign Function and Memory API " tutorial ( https://dev.java/learn/ffm/ ) #261

Description

@willy-b

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 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 sentence

    Some libraries are incredibly large (such as Windows.h), and you might not be need all the jextract generated code.

    "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

    An elegant solution is to use memory layouts that are more efficiently to initialize and can access more complex native data types such as C structures.

    "that are more efficiently to initialize" should be "that are more efficient to initialize".

  • In the sentence

    You can check the result of your work by pasting the above snippet in a jshell session and obtain:

    "obtain" should be "obtaining"..


Thanks very much!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions