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

Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2821,10 +2821,10 @@ private IllegalAccessException makeAccessException(Class<?> targetClass) {
* if and only if one of the following is true:
* <ul>
* <li>{@code targetClass} is in {@code M0} and {@code M1}
* {@linkplain Module#reads reads} {@code M0} and the type is
* {@linkplain Module#canRead(Module)} reads} {@code M0} and the type is
* in a package that is exported to at least {@code M1}.
* <li>{@code targetClass} is in {@code M1} and {@code M0}
* {@linkplain Module#reads reads} {@code M1} and the type is
* {@linkplain Module#canRead(Module)} reads} {@code M1} and the type is
* in a package that is exported to at least {@code M0}.
* <li>{@code targetClass} is in a third module {@code M2} and both {@code M0}
* and {@code M1} reads {@code M2} and the type is in a package
Expand Down Expand Up @@ -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 MethodHandles#zero(Class)
* @see MethodHandles#constant
* @since 9
*/
Expand Down
6 changes: 3 additions & 3 deletions src/java.base/share/classes/java/lang/invoke/MethodType.java
Original file line number Diff line number Diff line change
Expand Up @@ -1332,13 +1332,13 @@ private void writeObject(java.io.ObjectOutputStream s) throws java.io.IOExceptio
* deserialize it).
* This instance is a scratch object with bogus final fields.
* It provides the parameters to the factory method called by
* {@link #readResolve readResolve}.
* {@code readResolve}.
* After that call it is discarded.
* @param s the stream to read the object from
* @throws java.io.IOException if there is a problem reading the object
* @throws ClassNotFoundException if one of the component classes cannot be resolved
* @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)

*/
@java.io.Serial
private void readObject(java.io.ObjectInputStream s) throws java.io.IOException, ClassNotFoundException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

* added to the module if not already added.
*
* @param p
Expand Down
8 changes: 4 additions & 4 deletions src/java.base/share/classes/java/net/Socket.java
Original file line number Diff line number Diff line change
Expand Up @@ -679,7 +679,7 @@ public void connect(SocketAddress endpoint, int timeout) throws IOException {
* SocketAddress subclass not supported by this socket
*
* @since 1.4
* @see #isBound
* @see #isBound()
*/
public void bind(SocketAddress bindpoint) throws IOException {
int s = state;
Expand Down Expand Up @@ -1612,7 +1612,7 @@ private void closeSuppressingExceptions(Throwable parentException) {
* as well.
*
* @throws IOException if an I/O error occurs when closing this socket.
* @see #isClosed
* @see #isClosed()
*/
public void close() throws IOException {
synchronized (socketLock) {
Expand Down Expand Up @@ -1642,7 +1642,7 @@ public void close() throws IOException {
* @see java.net.Socket#shutdownOutput()
* @see java.net.Socket#close()
* @see java.net.Socket#setSoLinger(boolean, int)
* @see #isInputShutdown
* @see #isInputShutdown()
*/
public void shutdownInput() throws IOException {
int s = state;
Expand Down Expand Up @@ -1672,7 +1672,7 @@ public void shutdownInput() throws IOException {
* @see java.net.Socket#shutdownInput()
* @see java.net.Socket#close()
* @see java.net.Socket#setSoLinger(boolean, int)
* @see #isOutputShutdown
* @see #isOutputShutdown()
*/
public void shutdownOutput() throws IOException {
int s = state;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,11 +131,11 @@
* (including the case where a task was cancelled without executing);
* {@link #isCompletedNormally} is true if a task completed without
* cancellation or encountering an exception; {@link #isCancelled} is
* true if the task was cancelled (in which case {@link #getException}
* true if the task was cancelled (in which case {@link #getException()}
* 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.

* {@link CancellationException}.
*
* <p>The ForkJoinTask class is not usually directly subclassed.
Expand Down
2 changes: 1 addition & 1 deletion src/java.base/share/classes/javax/crypto/KEM.java
Original file line number Diff line number Diff line change
Expand Up @@ -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.

* In this case, the security provider should provide an
* {@code AlgorithmParameters} implementation using the same algorithm name
* as the KEM. The receiver can initiate such an {@code AlgorithmParameters}
Expand Down