Skip to content

Commit d0d6b91

Browse files
docs: load library with Arena.global()
Closes #29
1 parent 364154c commit d0d6b91

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

src/main/java/io/github/treesitter/jtreesitter/Language.java

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,9 @@ private static UnsatisfiedLinkError unresolved(String name) {
5959
* <h4 id="load-example">Example</h4>
6060
*
6161
* <p>{@snippet lang="java" :
62-
* Language language;
63-
* try (Arena arena = Arena.ofConfined()) {
64-
* String library = System.mapLibraryName("tree-sitter-java");
65-
* SymbolLookup symbols = SymbolLookup.libraryLookup(library, arena);
66-
* language = Language.load(symbols, "tree_sitter_java");
67-
* }
62+
* String library = System.mapLibraryName("tree-sitter-java");
63+
* SymbolLookup symbols = SymbolLookup.libraryLookup(library, Arena.global());
64+
* Language language = Language.load(symbols, "tree_sitter_java");
6865
* }
6966
*
7067
* @throws RuntimeException If the language could not be loaded.

src/main/java/io/github/treesitter/jtreesitter/package-info.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,7 @@
3030
* }
3131
* }
3232
*}
33+
*
34+
* @see <a href="https://github.com/openjdk/jextract/blob/master/doc/GUIDE.md#library-loading">Library Loading</a>
3335
*/
3436
package io.github.treesitter.jtreesitter;

0 commit comments

Comments
 (0)