[redo] Change java.time month/day field types to 'byte'

XMLWordPrintable

    • Type: Bug
    • Resolution: Unresolved
    • Priority: P4
    • tbd
    • Affects Version/s: 26
    • Component/s: core-libs
    • None

      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. The dedicated serialized form of each uses byte for the serialized values.

      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.)

      In the earlier change (JDK-8334742), changing the primitive type in the serialized class caused a compatibility issue between older and newer JDK versions. The serialized form of the class objects was incompatible.

      To retain compatibility of the class object serialized form the field names and types must be explicitly declared using the serialPersistentFields mechanism and the \@serialField declarations.

            Assignee:
            Roger Riggs
            Reporter:
            Roger Riggs
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: