RFR: JDK-8282798 java.lang.runtime.Carrier [v4]
Maurizio Cimadamore
mcimadamore at openjdk.java.net
Fri Mar 11 11:01:47 UTC 2022
On Thu, 10 Mar 2022 19:35:16 GMT, Jim Laskey <jlaskey 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.
>
> Jim Laskey has updated the pull request incrementally with one additional commit since the last revision:
>
> Leave public for the time being
src/java.base/share/classes/java/lang/runtime/Carrier.java line 48:
> 46:
> 47: /**
> 48: * This class is used to create anonymous objects that have number and types of
This is a bit ambiguous: anonymous "objects that have number and types of objects determined at runtime" almost seems like the clients have no control. I think what you want to say is that the shape is given by the client (e.g. how many longs, int, objects) - but the underlying implementation can vary. Maybe something like:
A <em>carrier</em> is an anonymous objects that can store component values. Valid component value types are [...]. Clients can create new carrier instances by describing a carrier <em>shape</em>, that is, a MethodType whose parameter types describe the types of the carrier component values.
src/java.base/share/classes/java/lang/runtime/Carrier.java line 57:
> 55: * @since 19
> 56: */
> 57: /*non-public*/
What does this non-public comment mean?
src/java.base/share/classes/java/lang/runtime/Carrier.java line 146:
> 144: * @return constructor with arguments recasted and reordered
> 145: */
> 146: private static MethodHandle reshapeConstructor(CarrierShape carrierShape,
I like how reshape constructors and components is now shared across both implementations
-------------
PR: https://git.openjdk.java.net/jdk/pull/7744
More information about the core-libs-dev
mailing list