RFR: 8264774: Implementation of Foreign Function and Memory API (Incubator) [v2]
Maurizio Cimadamore
mcimadamore at openjdk.java.net
Wed Apr 28 10:42:55 UTC 2021
On Wed, 28 Apr 2021 09:10:37 GMT, Chris Hegarty <chegar at openjdk.org> wrote:
>> Maurizio Cimadamore has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Address first batch of review comments
>
> src/jdk.incubator.foreign/share/classes/jdk/incubator/foreign/ResourceScope.java line 135:
>
>> 133: } finally {
>> 134: segment.scope().release(segmentHandle);
>> 135: }
>
> I do like the symmetry in this example, but just to add an alternative idiom:
> `segmentHandle.scope().release(segmentHandle)`
> , which guarantees to avoid release throwing and IAE
I see what you mean - I don't think I want to encourage that style too much by giving it prominence in the javadoc. It's true you can go back to the scope from the handle, so that you are guaranteed to release the right thing, but I think that should be unnecessary in most idiomatic uses.
-------------
PR: https://git.openjdk.java.net/jdk/pull/3699
More information about the nio-dev
mailing list