RFR: 8365588: defineClass that accepts a ByteBuffer does not work as expected [v2]
Xueming Shen
sherman at openjdk.org
Sat Oct 11 01:47:44 UTC 2025
On Fri, 10 Oct 2025 11:24:03 GMT, Alan Bateman <alanb at openjdk.org> wrote:
>> The test case has been updated to use @ParameterizedTest for the user-defined classloader, with the following variants.
>>
>>
>> static Stream<Arguments> bufferTypes() {
>> return Stream.of(
>> arguments(ARRAY_BUFFER, 0, false),
>> arguments(ARRAY_BUFFER_READONLY, 0, true),
>> arguments(DIRECT_BUFFER, 0, false),
>> arguments(DIRECT_BUFFER_READONLY, 0, false),
>> arguments(ARRAY_BUFFER, 16, false),
>> arguments(ARRAY_BUFFER_READONLY, 16, true),
>> arguments(DIRECT_BUFFER, 16, false),
>> arguments(DIRECT_BUFFER_READONLY, 16, false)
>> );
>> }
>>
>>
>> I keep the built-in classloader testing asis in the same test file for now. Let me know if you have a strong opinion to split it out.
>
> Good, but I think we think we need to test buffers created with ByteBuffer.allocateDirect and ByteBuffer.allocate. Also there are 4 arena types so allocating from each would make for a more complete test.
>
> One suggestion, up to you, is create all the buffers in the method source. That would allow additional buffers to be added without needing to change the test method to special case each one. (For the confined arena case it just means you can't close, but that's okay for this test).
Updated to test the following 8 types
static final int ARRAY_BUFFER = 0;
static final int WRAPPED_BUFFER = 1;
static final int DIRECT_BUFFER = 2;
static final int MAPPED_BUFFER = 3;
static final int FOREIGN_AUTO_BUFFER = 4;
static final int FOREIGN_CONFINED_BUFFER = 5;
static final int FOREIGN_GLOBAL_BUFFER = 6;
static final int FOREIGN_SHARED_BUFFER = 7;
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/27569#discussion_r2422365352
More information about the core-libs-dev
mailing list