uschindler opened a new pull request, #15093: URL: https://github.com/apache/lucene/pull/15093
This is a backport of #15089: It is more complicated than expected: - The method MethodHandles#filterCoordinates(...) method is preview in Java 21 as it is related to FFI and Panama. As it is called exactly one time I rewrote the code a bit to reflectively call it so the preview flag does not matter. Moving the whole code to the Java 21 part is not nice and requires additional lookups (also refelctive), so the cleast solution for calling that method is to just call it reflectively using a MathodHandle. - retrieving the VarHandle to access `MemorySegments` in the preview API (Java 21) is different than in the released Java 22+ API - In Java 21 the preview API requires `MethodHandles#memorySegmentViewVarHandle(layout)`. - In the released API (Java 22) it requires to use {@code layout.varHandle()}, which includes the offset coordinate. The new API existed before, but with different semantics, so we lookup the first one and if the method does not exist (we can compile against our stubs and see it, but at runtime it may have disappeared), we use the new API. This fixes #15079 in 10.x branch. I have tested the code with Java 21 (default), Java 22 and Java 24. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org