RFR: API classes supporting RuntimeTypes and ArrayCreation bootstraps
Chen Liang
liach at openjdk.org
Sat Aug 17 12:06:58 UTC 2024
On Sat, 17 Aug 2024 00:28:25 GMT, Dan Smith <dlsmith at openjdk.org> wrote:
> - Introduce the RuntimeType interface
> - Modify Class to implement RuntimeType
> - Introduce NullRestrictedClass as another implementation of RuntimeType
> - Provide ConstantDesc support for NullRestrictedClasses
> - Introduce reflection hooks to query RuntimeType of fields and arrays (just return Classes for now)
> - Provide ArrayCreation bootstraps to create arrays with RuntimeTypes, initial values, and flags (no runtime support for new features yet—implementation bottoms out at Array.newInstance)
> - Basic functionality testing of ArrayCreation bootstraps
Great work, few questions:
1. Does RuntimeType plan to model generic specialization or other restrictions, such as if a class must be a class or interface (such as for MethodHandles.Lookup) or not void (such as for method parameter types)?
2. Is it a good idea to make Class implement RuntimeType? This is weird in the perspective of primitives, that nothing can be cast to primitives and we have `void.class` as a RuntimeType too.
3. What's the interaction of strict fields with RuntimeType? Strict fields are necessary if a field's default value is not acceptable, can other fields still have RuntimeType as long as their initial values are accepted by the RuntimeType?
-------------
PR Comment: https://git.openjdk.org/valhalla/pull/1210#issuecomment-2294839933
More information about the valhalla-dev
mailing list