Skip to content

8380956: HexFormat shoud have @ValueBased#30444

Closed
YaSuenag wants to merge 1 commit into
openjdk:masterfrom
YaSuenag:JDK-8380956
Closed

8380956: HexFormat shoud have @ValueBased#30444
YaSuenag wants to merge 1 commit into
openjdk:masterfrom
YaSuenag:JDK-8380956

Conversation

@YaSuenag
Copy link
Copy Markdown
Member

@YaSuenag YaSuenag commented Mar 26, 2026

In #30392, we found out HexFormat is marked as value based class in Javadoc, but they do not have @ValueBased.

 * <p>
 * This is a <a href="{@docRoot}/java.base/java/lang/doc-files/ValueBased.html">value-based</a>
 * class; use of identity-sensitive operations (including reference equality
 * ({@code ==}), identity hash code, or synchronization) on instances of
 * {@code HexFormat} may have unpredictable results and should be avoided.
 * The {@code equals} method should be used for comparisons.
 * <p>
 * This class is immutable and thread-safe.
 * <p>
 * Unless otherwise noted, passing a null argument to any method will cause a
 * {@link java.lang.NullPointerException NullPointerException} to be thrown.
 *
 * @since 17
 */


public final class HexFormat {

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-8380956: HexFormat shoud have @ValueBased (Bug - P4)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 30444

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

Using diff file

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

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link
Copy Markdown

bridgekeeper Bot commented Mar 26, 2026

👋 Welcome back ysuenaga! 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
Copy Markdown

openjdk Bot commented Mar 26, 2026

@YaSuenag 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:

8380956: HexFormat shoud have @ValueBased

Reviewed-by: rriggs, stuefe, liach

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

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@openjdk openjdk Bot added the core-libs core-libs-dev@openjdk.org label Mar 26, 2026
@openjdk
Copy link
Copy Markdown

openjdk Bot commented Mar 26, 2026

@YaSuenag The following label will be automatically applied to this pull request:

  • core-libs

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

@YaSuenag YaSuenag marked this pull request as ready for review March 26, 2026 06:31
@openjdk openjdk Bot added the rfr Pull request is ready for review label Mar 26, 2026
@mlbridge
Copy link
Copy Markdown

mlbridge Bot commented Mar 26, 2026

Webrevs

Copy link
Copy Markdown
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 fine.

@RogerRiggs
Copy link
Copy Markdown
Contributor

There is no particular value to the annotation, except for consistency.

@openjdk openjdk Bot added the ready Pull request is ready to be integrated label Mar 26, 2026
Copy link
Copy Markdown
Member

@tstuefe tstuefe left a comment

Choose a reason for hiding this comment

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

+1

@liach
Copy link
Copy Markdown
Member

liach commented Mar 26, 2026

There is no particular value to the annotation, except for consistency.

I think JFR scans this annotation in class files and emits warning events upon synchronization.

* }</pre>
*
* <p>
* This is a <a href="{@docRoot}/java.base/java/lang/doc-files/ValueBased.html">value-based</a>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It looks like the note on value-based is going into the API note, same thing with the normative text about NPE. Doesn't have to be this PR but I think we should consider moving the text up so that it appears before the API note heading.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I think it should be do in another issue because it affects all of value based classes, and also the text is not normalized. For example:

HexFormat.java:

 * <p>
 * This is a <a href="{@docRoot}/java.base/java/lang/doc-files/ValueBased.html">value-based</a>
 * class; use of identity-sensitive operations (including reference equality
 * ({@code ==}), identity hash code, or synchronization) on instances of
 * {@code HexFormat} may have unpredictable results and should be avoided.
 * The {@code equals} method should be used for comparisons.
 * <p>
 * This class is immutable and thread-safe.
 * <p>

Linker.java:

 * @implSpec
 * Implementations of this interface are immutable, thread-safe and
 * <a href="{@docRoot}/java.base/java/lang/doc-files/ValueBased.html">value-based</a>.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think it should be do in another issue because it affects all of value based classes, and also the text is not normalized.

That's okay, it's clear we have several cases in the docs where normative and other text that appears after the @apiNote makes it appear that the text is part of the API note.

On a few occasions I've made to move the custom block tags that are @apiNote, @implNote .. and the text to the end of the class or method description to avoid the issue. A JEP has been submitted to add "Rish Notes" to API documentation that make help with some of these cases.

@YaSuenag
Copy link
Copy Markdown
Member Author

/integrate

@openjdk
Copy link
Copy Markdown

openjdk Bot commented Mar 27, 2026

Going to push as commit 2994524.
Since your change was applied there have been 33 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 Mar 27, 2026
@openjdk openjdk Bot closed this Mar 27, 2026
@openjdk openjdk Bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Mar 27, 2026
@openjdk
Copy link
Copy Markdown

openjdk Bot commented Mar 27, 2026

@YaSuenag Pushed as commit 2994524.

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

@YaSuenag YaSuenag deleted the JDK-8380956 branch March 27, 2026 13:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core-libs core-libs-dev@openjdk.org integrated Pull request has been integrated

Development

Successfully merging this pull request may close these issues.

5 participants