[foreign-memaccess+abi] RFR: 8307461: Linker::nativeLinker should not be restricted

Maurizio Cimadamore mcimadamore at openjdk.org
Thu May 4 14:43:44 UTC 2023


On Thu, 4 May 2023 14:36:11 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

> Since `Linker` is a sealed interface, we can now move restricted-ness from the static linker factory, down to the methods which are really problematic, namely `Linker::downcallHandle` and `Linker::upcallStub`.

test/jdk/java/foreign/handles/invoker_module/handle/invoker/MethodHandleInvoker.java line 92:

> 90:         addDefaultMapping(Consumer.class, (Consumer<Object>)(Object o) -> {});
> 91:         addDefaultMapping(FunctionDescriptor.class, FunctionDescriptor.ofVoid());
> 92:         addDefaultMapping(Linker.Option[].class, null);

This is a pragmatic change (not too proud of it). Since the linker methods are varargs, invoking these methods with `invokeWithArguments` will expect separate `Linker.Option` parameters instead of a single array. So I pass null instead.

-------------

PR Review Comment: https://git.openjdk.org/panama-foreign/pull/831#discussion_r1185115762


More information about the panama-dev mailing list