RFR: 8333793: Improve BootstrapMethodInvoker for ConstantBootstraps and ProxyGenerator
Claes Redestad
redestad at openjdk.org
Fri Jun 7 18:50:11 UTC 2024
On Fri, 7 Jun 2024 18:38:52 GMT, ExE Boss <duke at openjdk.org> wrote:
>> src/java.base/share/classes/java/lang/invoke/BootstrapMethodInvoker.java line 289:
>>
>>> 287: * bootstrap method.
>>> 288: */
>>> 289: private static final MethodType CONDY_GET_STATIC_FINAL_MT = MethodType.methodType(Object.class,
>>
>> This type should just be called `CONDY_NO_ARG` as it's the most common form of condy that doesn't take any arg (`nullConstant` `primitiveClass` etc.)
>
> Note that [`ConstantBootstraps::primitiveClass(Lookup, String, Class)`] has a static return type of `Class<?>`, so the following is also needed:
>
> /**
> * Exact type used of the {@link ConstantBootstraps#primitiveClass(Lookup, String, Class)}
> * bootstrap method.
> */
> private static final MethodType CONDY_CLASS_NO_ARG_MT
> = CONDY_GET_STATIC_FINAL_MT.changeReturnType(Class.class);
>
>
> [`ConstantBootstraps::primitiveClass(Lookup, String, Class)`]: https://docs.oracle.com/en/java/javase/22/docs/api/java.base/java/lang/invoke/ConstantBootstraps.html#primitiveClass(java.lang.invoke.MethodHandles.Lookup,java.lang.String,java.lang.Class)
It's not the intent of this PR to exhaustively enumerate all methods in `ConstantBootstraps`, primarily those shown to be bootstrap sensitive in some app. I've so far never seen a use of `primitiveClass` (and I admit being ignorant as to why this even exists as a BSM) so I don't have any reason to believe special-casing it will carry its own weight.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/19598#discussion_r1631578674
More information about the core-libs-dev
mailing list