Specifically, there is no need to add a serialVersionUID field, since the serialVersionUID of a record class is 0L unless explicitly declared, and the requirement for matching the serialVersionUID value is waived for record classes. Rarely, for migration compatibility between normal classes and record classes, a serialVersionUID may be declared, see Section 5.6.2 Compatible Changes of the Java Object Serialization Specification for more details.
To Reproduce
Set configOptions.serializableModel=true
Expected behavior
The field serialVersionUID is not needed, and should thus not be generated.
Additional context & Versions used
This is a bit tricky... this version is 0 by default, and is mostly ignored when deserializing. However, it is needed and does matter when migrating to/from classic java classes.
Describe the bug As stated here: https://docs.oracle.com/en/java/javase/20/serializable-records/index.html, there is no need to have this field in generated record classes, as stated:
To Reproduce Set
configOptions.serializableModel=true
Expected behavior The field
serialVersionUID
is not needed, and should thus not be generated.Additional context & Versions used This is a bit tricky... this version is 0 by default, and is mostly ignored when deserializing. However, it is needed and does matter when migrating to/from classic java classes.