On Mon, 13 Oct 2025 06:55:02 GMT, Alan Bateman <[email protected]> wrote:

>> Just tried to make the test code less verbose / repetitive :-) Updated 
>> accordingly.
>
> Thank you, this is much better. One other thing that will simplify it further 
> is to drop the posAtLimit parameter. Instead, 
> testDefineClassWithCustomLoaderByteBuffer can capture the bb position and 
> limit, then test their values after the defineClass, e.g.
> 
>         if (bb.isDirect() || bb.hasArray()) {
>             assertEquals(originalPos, bb.position());
>         } else {
>             assertEquals(originalLimit, bb.position());
>         }
>         assertEquals(originalLimit, bb.limit());
> 
> This will test long-standing (and undocumented) behavior. I created 
> JDK-8352583 on the spec issue. It would be too risky to change behavior and 
> advance the position. There may be some flexibility to not advance the 
> position for the read-only buffer case, but we would need to work through the 
> compatibility impacts of that. The fallback is to just document long standing 
> behavior.

updated as suggested.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/27569#discussion_r2425464873

Reply via email to