Skip to content

Conversation

@jddarcy
Copy link
Member

@jddarcy jddarcy commented Jun 20, 2023

I had occasion to read over the javadoc sources in java.lang.Object recently and noticed a few items that could be updated.

There are some new or expanded API notes referring to methods in java.util.Objects. I added these references as apiNote items rather than, say, @see tags since @see tag changes would propagate into classes that overrode the methods in questions.

Changing toString to use an inline @return tag has the consequence of omitting a trailing period, "." in the "Returns" section of its javadoc. This also omits a trailing period in subclasses that use the @return statement of Object.toString in their own toString method. Likewise for hashCode.


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-8310453: Update javadoc of java.lang.Object (Enhancement - P4)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 14567

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

Using diff file

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

Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Jun 20, 2023

👋 Welcome back darcy! 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 openjdk bot added the rfr Pull request is ready for review label Jun 20, 2023
@openjdk
Copy link

openjdk bot commented Jun 20, 2023

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

@openjdk openjdk bot added the core-libs core-libs-dev@openjdk.org label Jun 20, 2023
@mlbridge
Copy link

mlbridge bot commented Jun 20, 2023

Webrevs

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 Jun 20, 2023

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

8310453: Update javadoc of java.lang.Object

Reviewed-by: rriggs, alanb

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 44 new commits pushed to the master branch:

  • 370b8b2: 8310618: Test serviceability/sa/ClhsdbDumpclass.java fails after 8242152: 'StackMapTable:' missing from stdout/stderr
  • 5a30fb6: 8310591: Missing @since tags in java.lang.foreign
  • 8976ebf: 8310561: JFR: Unify decodeDescriptors(String, String)
  • 7da3f19: 8310549: avoid potential leaks in KeystoreImpl.m related to JNU_CHECK_EXCEPTION early returns
  • 8e04702: 8242152: SA does not include StackMapTables when dumping .class files
  • 3bc475e: 8309909: remove test nsk.jvmti test objmonusage006 from ProblemList-Virtual.txt
  • 3661cde: 8309853: StructuredTaskScope.join description improvements
  • ac44ef1: 8310586: ProblemList java/lang/ScopedValue/StressStackOverflow.java#default with virtual threads on linux-all
  • 3be50da: 8310512: Cleanup indentation in jfc files
  • f286e5a: 8310575: no @since for StandardDoclet
  • ... and 34 more: https://git.openjdk.org/jdk/compare/b2e86aef65f4d579896b6db83aaad408b6c580d4...master

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 ready Pull request is ready to be integrated label Jun 20, 2023
* @return a string representation of the object.
* }
* The {@link java.util.Objects#toIdentityString(Object)
* Objects.toIdentityString} method returns the string for an
Copy link
Member

Choose a reason for hiding this comment

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

That last sentence doesn't feel like it needs to be part of @implSpec, although there's definitely a connection.

Copy link
Member

Choose a reason for hiding this comment

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

That is, a clear connection to what's being described by that @implSpec.

Copy link
Contributor

Choose a reason for hiding this comment

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

This method has an existing apiNote and implSpec. I suspect Joe meant to add this sentence to the apiNote, not the implSpec.

Copy link
Member Author

Choose a reason for hiding this comment

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

I did mean to add the cross-reference to Objects.toIdentityString to the implSpec section since earlier in the implSpec section the expression that is the basis for Objects.toIdentityString is listed.

Copy link
Contributor

Choose a reason for hiding this comment

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

okay

* @return a string representation of the object.
* }
* The {@link java.util.Objects#toIdentityString(Object)
* Objects.toIdentityString} method returns the string for an
Copy link
Member

Choose a reason for hiding this comment

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

Separately, is it just me or this sentence could be rephrased to not read like toIdentityString(Object) accepts an object equal to the string (that would ...)?

@pavelrappo
Copy link
Member

While it's out of scope of this PR, I note that we could also use the inline variant of @return in those methods of Objects that the Object refers to: hash(Object), hashCode(Object...), and equals(Object, Object). In fact, I think they are crying for it.

* method whenever this method is overridden, so as to maintain the
* general contract for the {@code hashCode} method, which states
* that equal objects must have equal hash codes.
* <p>The two-argument {@link java.util.Objects#equals(Object,
Copy link
Member

Choose a reason for hiding this comment

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

I recommend a blank line before to make the paragraph break more obvious.

@pavelrappo
Copy link
Member

While it's out of scope of this PR, I note that we could also use the inline variant of @return in those methods of Objects that the Object refers to: hash(Object), hashCode(Object...), and equals(Object, Object). In fact, I think they are crying for it.

@jddarcy, I see you have since published a separate PR that includes those methods: #14608; thanks!

@jddarcy
Copy link
Member Author

jddarcy commented Jun 22, 2023

/integrate

@openjdk
Copy link

openjdk bot commented Jun 22, 2023

Going to push as commit 0e4fde3.
Since your change was applied there have been 45 commits pushed to the master branch:

  • 230bcb7: 8309685: Fix -Wconversion warnings in assembler and register code
  • 370b8b2: 8310618: Test serviceability/sa/ClhsdbDumpclass.java fails after 8242152: 'StackMapTable:' missing from stdout/stderr
  • 5a30fb6: 8310591: Missing @since tags in java.lang.foreign
  • 8976ebf: 8310561: JFR: Unify decodeDescriptors(String, String)
  • 7da3f19: 8310549: avoid potential leaks in KeystoreImpl.m related to JNU_CHECK_EXCEPTION early returns
  • 8e04702: 8242152: SA does not include StackMapTables when dumping .class files
  • 3bc475e: 8309909: remove test nsk.jvmti test objmonusage006 from ProblemList-Virtual.txt
  • 3661cde: 8309853: StructuredTaskScope.join description improvements
  • ac44ef1: 8310586: ProblemList java/lang/ScopedValue/StressStackOverflow.java#default with virtual threads on linux-all
  • 3be50da: 8310512: Cleanup indentation in jfc files
  • ... and 35 more: https://git.openjdk.org/jdk/compare/b2e86aef65f4d579896b6db83aaad408b6c580d4...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Jun 22, 2023
@openjdk openjdk bot closed this Jun 22, 2023
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Jun 22, 2023
@openjdk
Copy link

openjdk bot commented Jun 22, 2023

@jddarcy Pushed as commit 0e4fde3.

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

@jddarcy jddarcy deleted the JDK-8310453 branch October 17, 2024 16:54
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