Draft Object Serialization Specification for records - serialVersionUID
peter.levart at gmail.com
Sun Oct 6 21:23:20 UTC 2019
On Tuesday, October 1, 2019 12:56:55 PM CEST Chris Hegarty wrote:
> Please find a link to the draft serialization spec for records:
> This spec will be updated to reflect the upcoming core reflection
> changes for RecordComponent.
> Comments welcome.
Above draft says:
"""Any serialPersistentFields or serialVersionUID field declarations are also
ignored -- all record classes have a fixed serialVersionUID of 0L.
So how does this work with migration plan? When a record-like class C with
serialVersionUID != 0 is migrated to be a record, the stream produced with
class C can not be read by a program where C is a record. Or is the value of
serialVersionUID in the stream ignored when reading the stream into a record?
In that case writing class C -> reading record C is supported, but what about
writing record C -> reading class C ?
If you still want to support migration, then perhaps the default
serialVersionUID of records could be 0L always, but serialVersionUID field
would still be considered when this default needs to be overridden. So for
types that are records from day 1, users don't have to bother with
serialVersionUID fields, but if a type is migrated from class to record, this
can still be supported.
What do you think?
More information about the amber-spec-experts