RFR: 8331187: Optimize MethodTypeDesc and ClassDesc.ofDescriptor for primitive types [v3]

Claes Redestad redestad at openjdk.org
Fri Apr 26 13:34:45 UTC 2024


On Fri, 26 Apr 2024 12:58:35 GMT, Chen Liang <liach at openjdk.org> wrote:

>> src/java.base/share/classes/java/lang/constant/ClassDesc.java line 163:
>> 
>>> 161:         // implicit null-check
>>> 162:         return (descriptor.length() == 1)
>>> 163:                ? Wrapper.forPrimitiveType(descriptor.charAt(0)).primitiveClassDescriptor()
>> 
>> Wait a second, it seems `ClassDesc.ofDescriptor("L")` will return `ConstantDescs.CD_Object` now. Might be good to have a test to verify this doesn't happen.
>
> Ignore me, `Wrapper.ofPrimitiveType` doesn't return Object.

No, `Wrapper.forPrimitiveType` throws IAE if passed `L`, same exception as today with a slightly different message. 

And yes, if this does not happen there's a test that fails.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/18971#discussion_r1581042861


More information about the core-libs-dev mailing list