Skip to content

Commit 25cf626

Browse files
committed
Lazily invoke findLibrary to avoid UnsatisfiedLinkError when service loaded SymbolLookup successfuly found library
1 parent 3a04bc2 commit 25cf626

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/main/java/io/github/treesitter/jtreesitter/internal/ChainedLibraryLookup.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ public SymbolLookup get(Arena arena) {
2121
for (var libraryLookup : serviceLoader) {
2222
lookup = lookup.or(libraryLookup.get(arena));
2323
}
24-
return lookup.or(findLibrary(arena)).or(Linker.nativeLinker().defaultLookup());
24+
25+
return lookup.or((name) -> findLibrary(arena).find(name)).or(Linker.nativeLinker().defaultLookup());
2526
}
2627

2728
private static SymbolLookup findLibrary(Arena arena) {

0 commit comments

Comments
 (0)