On Mon, 5 Jan 2026 17:41:31 GMT, David Beaumont <[email protected]> wrote:

>> Remove ineffective/unused ImageBufferCache class, and simplify callers / 
>> remove dead code.
>> 
>> I removed the release methods in the internal classes, but the public 
>> ModuleReader API method is still there (the override can go away though 
>> since the default implementation also tests for non-null, so removing the 
>> override has no risk).
>> 
>> I suspect there are no implementations of ModuleReader that implement 
>> release semantics after this change, so perhaps we could relax the 
>> documentation around it? Thoughts welcome.
>
> David Beaumont has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   actually remove the class ...

src/java.base/share/classes/jdk/internal/jimage/BasicImageReader.java line 392:

> 390:     private static ByteBuffer allocateBuffer(long size) {
> 391:         if (size < 0 || Integer.MAX_VALUE < size) {
> 392:             throw new IndexOutOfBoundsException("size");

I don't think it can happen but I assume IAE would be more appropriate here as 
size is not an index.

src/java.base/share/classes/jdk/internal/jimage/BasicImageReader.java line 394:

> 392:             throw new IndexOutOfBoundsException("size");
> 393:         }
> 394:         ByteBuffer result = ByteBuffer.allocateDirect((int) ((size + 
> 0xFFF) & ~0xFFF));

Can you remind me why it allocates multiples of 4k?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/29043#discussion_r2662336397
PR Review Comment: https://git.openjdk.org/jdk/pull/29043#discussion_r2662334175

Reply via email to