On Wed, 16 Nov 2022 16:41:45 GMT, Maurizio Cimadamore <mcimadam...@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

Reply via email to