RFR: JDK-8282798 java.lang.runtime.Carrier

Jim Laskey jlaskey at openjdk.java.net
Tue Mar 8 20:10:06 UTC 2022


On Tue, 8 Mar 2022 16:00:48 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

>> We propose to provide a runtime anonymous carrier class object generator; java.lang.runtime.Carrier. This generator class is designed to share anonymous classes when shapes are similar. For example, if several clients require objects containing two integer fields, then Carrier will ensure that each client generates carrier objects using the same underlying anonymous class. 
>> 
>> See JBS for details.
>
> src/java.base/share/classes/java/lang/runtime/Carrier.java line 852:
> 
>> 850:      * @throws IllegalArgumentException if number of component slots exceeds maximum
>> 851:      */
>> 852:     public static MethodHandle constructor(MethodType methodType) {
> 
> What happens to the methodType return type? (both here and in the components method). Should javadoc say anything?

The return type is ignored. Going back to John's notion of just passing in the parameterTypes would work okay. I think when Brian wrote the original code he may have been thinking about keying on the MethodType (interned). I'll add a note about the return type.

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

PR: https://git.openjdk.java.net/jdk/pull/7744


More information about the core-libs-dev mailing list