On Fri, 2 May 2025 11:45:33 GMT, Maurizio Cimadamore <mcimadam...@openjdk.org> 
wrote:

>> src/java.base/share/classes/jdk/internal/foreign/BufferStack.java line 127:
>> 
>>> 125:                     arena,
>>> 126:                     new SlicingAllocator(arena.allocate(byteSize, 
>>> byteAlignment)),
>>> 127:                     new CleanupAction(arena));
>> 
>> any reason why you didn't use a lambda here?
>
> Also, not a big fan of records here -- it seems that many implementation 
> details such as cleanup action, lock and slicing allocator are "leaked out" 
> to the caller, that is now responsible to set things up correctly. I think a 
> `PerThread` class with a constructor taking arena, size, alignment would make 
> the code less coupled and more readable.

And, if you do that, you then don't need the `of` factory -- clients can just 
use `new`

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

PR Review Comment: https://git.openjdk.org/jdk/pull/24829#discussion_r2071498324

Reply via email to