RFR: 8295044: Implementation of Foreign Function and Memory API (Second Preview) [v27]

Alan Bateman alanb at openjdk.org
Wed Nov 16 16:04:17 UTC 2022


On Tue, 15 Nov 2022 18:47:39 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

>> This PR contains the API and implementation changes for JEP-434 [1]. A more detailed description of such changes, to avoid repetitions during the review process, is included as a separate comment.
>> 
>> [1] - https://openjdk.org/jeps/434
>
> Maurizio Cimadamore has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Fix typo in SegmentScope javadoc

src/java.base/share/classes/java/lang/foreign/Arena.java line 132:

> 130:      * and all the memory segments associated with it can no longer be accessed. Furthermore, any off-heap region of memory backing the
> 131:      * segments associated with that scope are also released.
> 132:      * @throws IllegalStateException if the arena has already been {@linkplain #close() closed}.

It's not wrong to specify that close throw if already closed but it goes against the advice in AutoCloseable to try to have close methods be idempotent. There may be a good reason for this but I can't help wondering if there are error cases when wrapping that might lead to close being called more than once.

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

PR: https://git.openjdk.org/jdk/pull/10872


More information about the hotspot-dev mailing list