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

Closed

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)

Reviewers

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

@gauthamkrishnanibm This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

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

Reviewed-by: rriggs

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 478 new commits pushed to the master branch:

As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@RogerRiggs) but any other Committer may sponsor as well.

➡️ To flag this PR as ready for integration with the above commit message, type /integrate in a new comment. (Afterwards, your sponsor types /sponsor in a new comment to perform the integration).

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

@RogerRiggs
Copy link
Contributor

Passed CI tier 1-3.

Copy link
Contributor

@RogerRiggs RogerRiggs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good

@openjdk
Copy link

openjdk bot commented May 27, 2025

⚠️ @gauthamkrishnanibm the full name on your profile does not match the author name in this pull requests' HEAD commit. If this pull request gets integrated then the author name from this pull requests' HEAD commit will be used for the resulting commit. If you wish to push a new commit with a different author name, then please run the following commands in a local repository of your personal fork:

$ git checkout JDK-8334742
$ git commit --author='Preferred Full Name <[email protected]>' --allow-empty -m 'Update full name'
$ git push

@openjdk openjdk bot added the ready Pull request is ready to be integrated label May 27, 2025
@gauthamkrishnanibm
Copy link
Contributor Author

/integrate

@openjdk openjdk bot added the sponsor Pull request is ready to be sponsored label May 28, 2025
@openjdk
Copy link

openjdk bot commented May 28, 2025

@gauthamkrishnanibm
Your change (at version 148c383) is now ready to be sponsored by a Committer.

@RogerRiggs
Copy link
Contributor

/sponsor

@openjdk
Copy link

openjdk bot commented May 28, 2025

Going to push as commit 4ced4e7.
Since your change was applied there have been 478 commits pushed to the master branch:

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label May 28, 2025
@openjdk openjdk bot closed this May 28, 2025
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review sponsor Pull request is ready to be sponsored labels May 28, 2025
@openjdk
Copy link

openjdk bot commented May 28, 2025

@RogerRiggs @gauthamkrishnanibm Pushed as commit 4ced4e7.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

@gauthamkrishnanibm gauthamkrishnanibm deleted the JDK-8334742 branch June 12, 2025 06:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

3 participants