uschindler commented on code in PR #15843:
URL: https://github.com/apache/lucene/pull/15843#discussion_r2965427247
##########
lucene/core/src/java/org/apache/lucene/store/PosixNativeAccess.java:
##########
@@ -79,14 +81,12 @@ static Optional<NativeAccess> getInstance() {
+ "pass the following on command line:
--enable-native-access=%s",
Optional.ofNullable(PosixNativeAccess.class.getModule().getName())
.orElse("ALL-UNNAMED")));
- } catch (RuntimeException | Error e) {
Review Comment:
It is not brittle. The reason for the `catch (Throwable)` and the
corresponding `catch (Runtime+Error)` is the general pattern used in Lucene
when you execute a `MethodHandle` (here it happens when you get page size). As
panama method handles by default never throw anything (thats defined in spec,
the assertion is correct. But if you catch Throwable, you have to filter on
RuntimException and Error to not swallow or mis-rethrow the runtime exception.
Thats needed for correctness of code.
It does not make it briddle. The same type of code is also used inside the
JVM. That's how it should be. The feature is optional, but it the lookup is not
briddle.
There is actually a bug, but it is fixed here. It may catch on a JVM or
platform that has no native support at all. It was caused by a refactoring done
by @jpountz (see above).
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]