-
Bug
-
Resolution: Unresolved
-
P3
-
repo-valhalla
The ValueClass.newArrayInstance method has been replaced by separate methods for creating arrays of value classes with semantics for atomic and null-restricted.
The CheckedType mechanism is no longer needed by ValueClass to support VarHandles.
The NullRestricted flag for a class is handled separately from the type.
Comment describing the previous state:
Method ValueClass.newArrayInstance(CheckedType componentType, int length) is supposed to returned an array based on the componentType argument. If the componenType argument is an instance of NullRestrictedCheckedType, the method returns a null-free array, otherwise a regular array is returned.
This model worked well when there was a single kind of null-free array per value class and a default value was available to fill the elements of the null-free array.
The concept of default value is being removed, and the new factories for null-free arrays require an additional argument, a value to be used to fill the array's element (this is a temporary solution, but more language work is needed to provide more flexible solutions to fill the array).
And the VM is now capable of providing different layouts (with different properties) of null-free arrays, each one being created with a different factory. The factory currently used in newArrayInstance() is obsolete and will eventually be removed, and the assumption that there's a single factory is now inexact.
The method should be either be updated to reflect the new model, or completely removed if the method purpose doesn't fit in the new model.
The CheckedType mechanism is no longer needed by ValueClass to support VarHandles.
The NullRestricted flag for a class is handled separately from the type.
Comment describing the previous state:
Method ValueClass.newArrayInstance(CheckedType componentType, int length) is supposed to returned an array based on the componentType argument. If the componenType argument is an instance of NullRestrictedCheckedType, the method returns a null-free array, otherwise a regular array is returned.
This model worked well when there was a single kind of null-free array per value class and a default value was available to fill the elements of the null-free array.
The concept of default value is being removed, and the new factories for null-free arrays require an additional argument, a value to be used to fill the array's element (this is a temporary solution, but more language work is needed to provide more flexible solutions to fill the array).
And the VM is now capable of providing different layouts (with different properties) of null-free arrays, each one being created with a different factory. The factory currently used in newArrayInstance() is obsolete and will eventually be removed, and the assumption that there's a single factory is now inexact.
The method should be either be updated to reflect the new model, or completely removed if the method purpose doesn't fit in the new model.