RFR: 8365588: defineClass that accepts a ByteBuffer does not work as expected [v5]

Xueming Shen sherman at openjdk.org
Mon Oct 13 02:18:56 UTC 2025


On Sun, 12 Oct 2025 07:12:49 GMT, Alan Bateman <alanb at openjdk.org> wrote:

>> Xueming Shen has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   test case update
>
> test/jdk/java/lang/ClassLoader/defineClass/DefineClassDirectByteBuffer.java line 192:
> 
>> 190:     @MethodSource("bufferTypes")
>> 191:     void testDefineClassWithCustomLoaderByteBuffer(int type, boolean readonly, int pos, boolean posAtLimit)
>> 192:             throws Exception
> 
> Have you tried changing the method source to create a stream of the ByteBuffers to test? 
> 
> In the current version we need to add to bufferTypes(), getByteBufferWithTestClassBytes(), and maybe adding a new constant, in order to add a new buffer to test. I suspect it would be a lot simpler if method source created all the buffers (including the read-only buffers), and testDefineClassWithCustomLoaderByteBuffer just tests defineClass with that BB.

Just tried to make the test code less verbose / repetitive :-) Updated accordingly.

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

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


More information about the core-libs-dev mailing list