RFR: 8282191: Implementation of Foreign Function & Memory API (Preview) [v15]

ExE Boss duke at openjdk.java.net
Wed Mar 30 22:25:44 UTC 2022


On Wed, 30 Mar 2022 20:59:34 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

>> This PR contains the API and implementation changes for JEP-424 [1]. A more detailed description of such changes, to avoid repetitions during the review process, is included as a separate comment.
>> 
>> [1] - https://openjdk.java.net/jeps/424
>
> Maurizio Cimadamore has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Tweak FunctionDescriptor::argumentLayouts to return an immutable list

src/java.base/share/classes/java/lang/foreign/FunctionDescriptor.java line 73:

> 71:      */
> 72:     public List<MemoryLayout> argumentLayouts() {
> 73:         return Collections.unmodifiableList(argLayouts);

This change doesn’t seem to be necessary, as `FunctionDescriptor` is already created with `List.of(…)` (or `Stream.toList()` in the case of `FunctionDescriptor.VariadicFunction`), which produce immutable lists (although `Stream.toList()` permits `null`s, which `Stream.collect(Collectors.toImmutableList())` and `List.of(…)` doesn’t).

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

PR: https://git.openjdk.java.net/jdk/pull/7888



More information about the security-dev mailing list