Draft Object Serialization Specification for records - update

Peter Levart peter.levart at gmail.com
Tue Oct 22 08:57:42 UTC 2019


Hi Chris,

On 10/15/19 1:28 PM, Chris Hegarty wrote:
> Please find a link to an updated draft serialization spec for records.
> This version contains all comments and feedback so far.
>
> https://cr.openjdk.java.net/~chegar/records/spec/records-serialization.04.html
>
> * Updated to reflect the new Class::getRecordComponents
> * For migration from a record class to a record-like class, a record may declare serialVersionUID, which is effectively ignored when local class equivalent of the specified stream class descriptor is a record class
I don't see this in the text. Specifically in 1.13. the text says:

"Any serialPersistentFields or serialVersionUID field declarations are 
also ignored -- all record classes have a fixed serialVersionUID of 0L."

And in 4.6. it says:

"The serialVersionUID for dynamic proxy classes, enum types, and record 
classes, is always the value 0L."

Also the implementation of records serialization proposed on 
core-libs-dev by Vincente is alligned with this text.


I note that enums took an approach where their serialVersionUID is 
always 0L, but their serialization format is also very different than 
that of any enum-like class. Cross-serialization compatibility between 
enum-like class and enum was not a goal then.

If records vs. record-like classes have a goal of Cross-serialization 
compatibility, then explicit serialVersionUID static final field on 
records must be respected during serialization, but can be ignored 
during deserialization to enable later removing of the static field when 
migration from record-like class is finally complete.

Regards, Peter



More information about the amber-spec-experts mailing list