RFR: 8334742: Change java.time month/day field types to 'byte'

Gautham Krishnan duke at openjdk.org
Wed Apr 30 20:35:19 UTC 2025


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.

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

Commit messages:
 - Changing month and day value data type to byte

Changes: https://git.openjdk.org/jdk/pull/24975/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=24975&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8334742
  Stats: 16 lines in 4 files changed: 0 ins; 0 del; 16 mod
  Patch: https://git.openjdk.org/jdk/pull/24975.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/24975/head:pull/24975

PR: https://git.openjdk.org/jdk/pull/24975


More information about the core-libs-dev mailing list