[lworld] RFR: 8281295: Prototype serialization/deserialization using Unsafe. [v5]

Mandy Chung mchung at openjdk.org
Fri Oct 14 00:55:38 UTC 2022


On Thu, 13 Oct 2022 19:53:46 GMT, Roger Riggs <rriggs at openjdk.org> wrote:

>> Specify serialization and deserialization of value objects. Value objects are immutable, Externalizable relies on mutation, Externalizable is not supported for value objects. Revised tests and added tests for graphs of value objects.
>> 
>> Somewhat similar to Record serialization in that back references to the value object store 'null' until the value object is completely deserialized.
>> Similar to regular serialization/deserialization of identity objects.  The serialized form is the same.
>> Deserialization is done by reading fields and storing into a Buffered larval object, converted to a value object when all of the fields have been read and stored.
>> 
>> Externalizable and Value Objects are incompatible, value objects are immutable and Externalizable.readExternal is expected to modify the fields of an allocated object.
>
> Roger Riggs has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Add primitive class signatures to be treated the same as L types

To recap our offline discussion, I would expect `ObjectStreamField::getTypeString` should return `Q-`descriptor if the field type is a primitive class value type (consistent with `Field`).   For example,


class Test implements Serializable {
   SerializablePrimitivePoint p;
   SerializableValuePoint v;
}


where `p` may be a flattened field of a primitive class value type but `v` is a field of a reference type (value class).   In that case, `Field.getType().descriptorString()` on `p`  should return `QSerializablePrimitivePoint;`.

Since this involves the interoperability and future evolution, perhaps add the serialization support for primitive classes as a follow-on issue.   Better to revert the change added for `Q` descriptor and keep this PR for value class only.

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

PR: https://git.openjdk.org/valhalla/pull/761



More information about the valhalla-dev mailing list