RFR: 8371732: [redo] Change java.time month/day field types to 'byte' [v2]

Dan Smith dlsmith at openjdk.org
Sat Nov 15 21:19:09 UTC 2025


On Fri, 14 Nov 2025 20:15:03 GMT, Roger Riggs <rriggs at openjdk.org> wrote:

>> Redo change (8371732) that failed when the updated class objects were incompatible.
>> The fields of classes are changed to allow a more compact form of storage.
>> 
>> To ensure compatibility of the class objects, the fields are explicitly declared in SerialPersistentFields with the original field types.
>> The fields are marked `transient` to indicate the field declarations are not used for serialization.
>> The affected classes are java.time.LocalDate, MonthDay, and YearMonth.
>> Tests are added to verify the types and names of serialized fields of each class.
>> 
>> HijrahDate only changes the field types, the fields are transient and there is no change to the serialized from of the HijrahDate.class object.
>
> Roger Riggs has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Use "Java SE 8" instead of version 1.8

And then HijrahDate is weird, because it doesn't seem to declare `serialPersistentFields`? That's also fine, because the use of `transient` means that the implicit serializable field declaration is an empty set. But it's a little confusing that there's not one uniform strategy used everywhere.

Suggested (low-priority) followup: for all of these classes that use a proxy and throw in `readObject`, either declare all the fields `transient`, or declare an empty `serialPersistentFields`. No need to do both, but should use the same strategy everywhere.

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

PR Comment: https://git.openjdk.org/jdk/pull/28274#issuecomment-3536902621


More information about the core-libs-dev mailing list