Skip to content

8356632: Fix remaining {@link/@linkplain} tags with refer to private/protected types in java.base #25287

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

Conversation

nizarbenalla
Copy link
Member

@nizarbenalla nizarbenalla commented May 17, 2025

Please review this patch to fix some javadoc bugs in java.base.
Certain @link tags used to refer to private fields instead of public APIs.

A couple of @see tags in the serialization page referred to private methods, I updated the javadoc in a way to not change the way it is displayed to users but also remove @link tags to non-included types.

TIA


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-8356632: Fix remaining {@link/@linkplain} tags with refer to private/protected types in java.base (Sub-task - P4)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 25287

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

Using diff file

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

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented May 17, 2025

👋 Welcome back nbenalla! 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 May 17, 2025

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

8356632: Fix remaining {@link/@linkplain} tags with refer to private/protected types in java.base

Reviewed-by: weijun, 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 113 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
Copy link

openjdk bot commented May 17, 2025

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

  • core-libs
  • net
  • security

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.

@@ -4890,7 +4890,7 @@ private static MethodHandle identityOrVoid(Class<?> type) {
* @param type the type of the desired method handle
* @return a constant method handle of the given type, which returns a default value of the given return type
* @throws NullPointerException if the argument is null
* @see MethodHandles#primitiveZero
* @see <code>primitiveZero(Wrapper)</code>
Copy link
Member

Choose a reason for hiding this comment

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

Just #zero(Class) should be sufficient. This is probably changed by intellij during my original work to consolidate zero and constant.

Choose a reason for hiding this comment

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

From #23706 (comment):

Suggested change
* @see <code>primitiveZero(Wrapper)</code>
* @see MethodHandles#zero

* @see #readResolve
* @see #writeObject
* @see <code>MethodType.readResolve()</code>
* @see <code>MethodType.writeObject(ObjectOutputStream s)</code>
Copy link
Member

Choose a reason for hiding this comment

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

This is already not generated by the javadoc as this method is private. Why is this check against a private method?

Copy link
Member Author

Choose a reason for hiding this comment

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

They are documented in this page

Copy link
Member

Choose a reason for hiding this comment

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

Okay -- if there is some link to the private serial-related methods even in a public javadoc run, I think it would be preferable if links to those methods could be resolved by javadoc. Otherwise, if the links to private methods from a private method, would be valid in a private javadoc run, I thinks more refined version of warning would let those be.

As it is, if the see tags are going to stay, I don't think <code>foo</code> markup should be used.

Copy link
Member Author

@nizarbenalla nizarbenalla May 20, 2025

Choose a reason for hiding this comment

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

I will revert the changes to MethoType.java and try to make the links to the private methods resolvable. (In a future patch)

@nizarbenalla nizarbenalla marked this pull request as ready for review May 19, 2025 16:04
@openjdk openjdk bot added the rfr Pull request is ready for review label May 19, 2025
@mlbridge
Copy link

mlbridge bot commented May 19, 2025

Webrevs

* returns a {@link CancellationException}); and
* {@link #isCompletedAbnormally} is true if a task was either
* cancelled or encountered an exception, in which case {@link
* #getException} will return either the encountered exception or
* #getException()} will return either the encountered exception or
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks right too, the private overload of getException was added in JDK 22.

@@ -2020,7 +2020,7 @@ public Builder uses(String service) {

/**
* Provides a service with one or more implementations. The package for
* each {@link Provides#providers provider} (or provider factory) is
* each {@link Provides#providers() provider} (or provider factory) is
Copy link
Contributor

Choose a reason for hiding this comment

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

okay

Copy link
Member

@dfuch dfuch left a comment

Choose a reason for hiding this comment

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

Changes to java.net.Socket LGTM

Copy link
Member

@liach liach left a comment

Choose a reason for hiding this comment

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

Changes to MethodHandles look good. Please wait for a review from security developers for KEM.java.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label May 22, 2025
@@ -708,7 +708,7 @@ public Encapsulator newEncapsulator(PublicKey publicKey, SecureRandom secureRand
* If any extra information inside this object needs to be transmitted along
* with the key encapsulation message so that the receiver is able to create
* a matching decapsulator, it will be included as a byte array in the
* {@link Encapsulated#params} field inside the encapsulation output.
* {@link Encapsulated#params()} field inside the encapsulation output.
Copy link
Contributor

@wangweij wangweij May 23, 2025

Choose a reason for hiding this comment

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

Good catch. The text must have been added before we changed Encapsulated from a record to a normal class. Now that params is a method instead of a record field, please consider rewriting the sentence to something like

it will be included as a byte array returned by the
{@link Encapsulated#params()} method within the
encapsulation output.

@openjdk openjdk bot removed the ready Pull request is ready to be integrated label May 23, 2025
Copy link
Contributor

@wangweij wangweij left a comment

Choose a reason for hiding this comment

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

The KEM.java change looks good to me. Thanks.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label May 23, 2025
@nizarbenalla
Copy link
Member Author

All files have been reviewed. Thanks All!

/integrate

@openjdk
Copy link

openjdk bot commented May 26, 2025

Going to push as commit bd09589.
Since your change was applied there have been 137 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 26, 2025
@openjdk openjdk bot closed this May 26, 2025
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels May 26, 2025
@openjdk
Copy link

openjdk bot commented May 26, 2025

@nizarbenalla Pushed as commit bd09589.

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

@nizarbenalla nizarbenalla deleted the fix-incorrect-link-tags-java.base branch May 26, 2025 12:46
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.

7 participants