Description
In the following classes, month and day values are stored in fields of type 'int' or 'short'. The range of allowed values is small enough that the type can be 'byte' instead.
java.time.YearMonth
java.time.MonthDay
java.time.LocalDate
java.time.chono.HijrahDate
Refactoring the type will give the JVM a little more layout flexibility, and will be especially useful when these classes become value classes. (For example, it reduces YearMonth and MonthDay to a payload size smaller than 64 bits, which can be significant.)
Generally, field type changes are disruptive to serialization, but these classes use a custom Externalizable encoding (see 'readExternal'/'writeExternal') which already stores these values as bytes.
java.time.YearMonth
java.time.MonthDay
java.time.LocalDate
java.time.chono.HijrahDate
Refactoring the type will give the JVM a little more layout flexibility, and will be especially useful when these classes become value classes. (For example, it reduces YearMonth and MonthDay to a payload size smaller than 64 bits, which can be significant.)
Generally, field type changes are disruptive to serialization, but these classes use a custom Externalizable encoding (see 'readExternal'/'writeExternal') which already stores these values as bytes.
Attachments
Issue Links
- relates to
-
JDK-8317279 Standard library implementation of value classes and objects
- In Progress