File tree Expand file tree Collapse file tree 5 files changed +9
-10
lines changed
src/main/java/io/github/treesitter/jtreesitter Expand file tree Collapse file tree 5 files changed +9
-10
lines changed Original file line number Diff line number Diff line change @@ -10,14 +10,12 @@ Java bindings to the [tree-sitter] parsing library.
1010
1111- Install JDK 22 and set ` JAVA_HOME ` to it
1212- Download [ jextract] and add it to your ` PATH `
13+ - Install the ` tree-sitter ` & ` tree-sitter-java ` libraries
1314
1415``` bash
1516git clone https://github.com/tree-sitter/java-tree-sitter
1617cd java-tree-sitter
17- git submodule init
18- git submodule update
19- # build tree-sitter and tree-sitter-java native libraries,
20- # for example by replicating the steps in .github/workflows/ci.yml
18+ git submodule update --init
2119mvn test
2220```
2321
Original file line number Diff line number Diff line change 8181 <skip >${jextract.skip} </skip >
8282 <target name =" jextract" >
8383 <echo level =" info" >Generating sources using jextract</echo >
84- <exec osfamily =" windows" executable =" powershell" failonerror =" true" >
85- <arg value =" ${project.basedir}/scripts/jextract.ps1" />
84+ <exec osfamily =" windows" executable =" ${project.basedir}/scripts/jextract.ps1" failonerror =" true" >
8685 <arg value =" ${project.basedir}" />
8786 <arg value =" ${project.build.directory}" />
8887 </exec >
Original file line number Diff line number Diff line change 1- --- a/target/ generated-sources/jextract/io/github/treesitter/jtreesitter/internal/TreeSitter.java
2- +++ b/target/ generated-sources/jextract/io/github/treesitter/jtreesitter/internal/TreeSitter.java
1+ --- a/generated-sources/jextract/io/github/treesitter/jtreesitter/internal/TreeSitter.java
2+ +++ b/generated-sources/jextract/io/github/treesitter/jtreesitter/internal/TreeSitter.java
33@@ -55,9 +55,7 @@
44 };
55 }
Original file line number Diff line number Diff line change 1010 *
1111 * @see java.util.ServiceLoader
1212 */
13+ @ FunctionalInterface
1314public interface NativeLibraryLookup {
1415 /**
1516 * Returns the {@link SymbolLookup} to be used for the tree-sitter native library.
Original file line number Diff line number Diff line change @@ -11,16 +11,17 @@ final class ChainedLibraryLookup implements NativeLibraryLookup {
1111 @ Override
1212 public SymbolLookup get (Arena arena ) {
1313 var serviceLoader = ServiceLoader .load (NativeLibraryLookup .class );
14+ // NOTE: can't use _ because of palantir/palantir-java-format#934
1415 SymbolLookup lookup = (name ) -> Optional .empty ();
1516 for (var libraryLookup : serviceLoader ) {
1617 lookup = lookup .or (libraryLookup .get (arena ));
1718 }
1819 return lookup .or (findLibrary (arena )).or (Linker .nativeLinker ().defaultLookup ());
1920 }
2021
21- private SymbolLookup findLibrary (Arena arena ) {
22+ private static SymbolLookup findLibrary (Arena arena ) {
2223 try {
23- String library = System .mapLibraryName ("tree-sitter" );
24+ var library = System .mapLibraryName ("tree-sitter" );
2425 return SymbolLookup .libraryLookup (library , arena );
2526 } catch (IllegalArgumentException e ) {
2627 return SymbolLookup .loaderLookup ();
You can’t perform that action at this time.
0 commit comments