On Wed, 16 Nov 2022 16:38:10 GMT, Alan Bateman <al...@openjdk.org> wrote:

>> In our experience with using the API, having exceptions when something is 
>> funny about close is very valuable info (as also stated in the javadoc). 
>> Almost always there's a subtle temporal bug going on which the ISE catches. 
>> I'm not sure if here you refer to the fact that the javadoc is being overly 
>> broad in saying "already been closed" instead of "already been closed 
>> _successfully_" ? What kind of problems are you thinking of?
>
> 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.

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

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

Reply via email to