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

Maurizio Cimadamore mcimadamore at openjdk.org
Wed Nov 16 16:54:41 UTC 2022


On Wed, 16 Nov 2022 16:41:45 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

>> Most of the AutoCloseable in the platform are Closeables where close is specified to have no effect when already closed. With a confined Arena it would be benign for the owner to invoke close again. If it's been useful at finding bugs then okay. The scenario that made me wonder about this is something like the follow where MyWrapper::close invokes Arena::close.
>> 
>>         try (var arena = Arena.openConfined();
>>              var wrapper = new MyWrapper(arena)) {
>>             :
>>         }
>
> Actually, I see that the `@apiNote` we used to have has disappeared in the API reshuffling. I will add it back.

> Most of the AutoCloseable in the platform are Closeables where close is specified to have no effect when already closed. With a confined Arena it would be benign for the owner to invoke close again. If it's been useful at finding bugs then okay. The scenario that made me wonder about this is something like the follow where MyWrapper::close invokes Arena::close.
> 
> ```
>         try (var arena = Arena.openConfined();
>              var wrapper = new MyWrapper(arena)) {
>             :
>         }
> ```

Sure - this would be problematic - however it seems an edge case (could the TWR just use MyWrapper?)

I'd prefer to leave it as is for now, and revisit - so far we had no indications of this being a real problem, whereas we had cases where the thrown exception has been useful to spot issues. If consistency with the rest of the JDK is considered more important we can fix it later.

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

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


More information about the core-libs-dev mailing list