Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

gauthamkrishnanibm
Copy link
Contributor

@gauthamkrishnanibm gauthamkrishnanibm commented Apr 30, 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.


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

  • JDK-8334742: Change java.time month/day field types to 'byte' (Bug - P4)

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/24975/head:pull/24975
$ git checkout pull/24975

Update a local copy of the PR:
$ git checkout pull/24975
$ git pull https://git.openjdk.org/jdk.git pull/24975/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 24975

View PR using the GUI difftool:
$ git pr show -t 24975

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/24975.diff

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Apr 30, 2025

👋 Welcome back gauthamkrishnanibm! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk
Copy link

openjdk bot commented Apr 30, 2025

❗ This change is not yet ready to be integrated.
See the Progress checklist in the description for automated requirements.

@openjdk openjdk bot added the rfr Pull request is ready for review label Apr 30, 2025
@openjdk
Copy link

openjdk bot commented Apr 30, 2025

@gauthamkrishnanibm The following labels will be automatically applied to this pull request:

  • core-libs
  • i18n

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing lists. If you would like to change these labels, use the /label pull request command.

@mlbridge
Copy link

mlbridge bot commented Apr 30, 2025

Webrevs

@naotoj
Copy link
Member

naotoj commented Apr 30, 2025

Since they are serialized fields (except Hijrah ones), I don't think this is doable.

@gauthamkrishnanibm
Copy link
Contributor Author

@naotoj Thanks for reviewing.

You are right.
But when I checked these classes use a custom Externalizable encoding (see 'readExternal'/'writeExternal'), which already stores these values as bytes.

@naotoj
Copy link
Member

naotoj commented Apr 30, 2025

But when I checked these classes use a custom Externalizable encoding (see 'readExternal'/'writeExternal'), which already stores these values as bytes.

Sorry, that is correct. Jumped the gun too soon

@RogerRiggs
Copy link
Contributor

Its recommended to set the assignee of a issue before starting working and to mark it in progress.
@gauthamkrishnanibm Please make the necessary changes to the issue to let people know you are working on it.

@gauthamkrishnanibm
Copy link
Contributor Author

@RogerRiggs
Sorry. I am not having write access to JBS as I just started contributing.
Should I discuss about the change in mailing list ?

@RogerRiggs
Copy link
Contributor

I hope you've found The OpenJDK Developers' Guide, its a good read to know what to expect and what is expected of contributors.
Feel free to ask on the mail alias about how things work. If you found the issue you would have seen it was already assigned and it would be appropriate to ask.

Please continue.
As with any modification, its important to identify the tests that validate the change. In this case, the tests are in the repo under test/jdk/java/time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

3 participants