Skip to content
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

8329745: Update the documentation of ServerSocket and Socket to refer to StandardSocketOptions instead of legacy SocketOptions #18646

Closed
wants to merge 4 commits into from

Conversation

jaikiran
Copy link
Member

@jaikiran jaikiran commented Apr 5, 2024

Can I please get a review of this doc-only changes to java.net.ServerSocket and java.net.Socket classes?

As noted in https://bugs.openjdk.org/browse/JDK-8329745, these classes currently refer to the legacy java.net.SocketOptions interface and instead should be refering to the newer java.net.StandardSocketOptions class. The commit in this PR updates such references. This change intentionally doesn't do any code changes to use the StandardSocketOptions class - that can be done separately if desired at a later point (after testing for any compatibility issues). Finally, there are a few places in ServerSocket and Socket documentation which will continue to refer to java.net.SocketOptions legacy interface because few of the options aren't available in StandardSocketOptions class (for example, SO_TIMEOUT).

I ran make docs-image locally with this change and the generated doc looks OK to me.


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-8329745: Update the documentation of ServerSocket and Socket to refer to StandardSocketOptions instead of legacy SocketOptions (Enhancement - P4)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 18646

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

Using diff file

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

Webrev

Link to Webrev Comment

… to StandardSocketOptions instead of legacy SocketOptions
@bridgekeeper
Copy link

bridgekeeper bot commented Apr 5, 2024

👋 Welcome back jpai! 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 5, 2024

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

8329745: Update the documentation of ServerSocket and Socket to refer to StandardSocketOptions instead of legacy SocketOptions

Reviewed-by: alanb, dfuchs

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

  • 8907eda: 8325485: IncrementInstructions.of(int, int) is not storing the args
  • b9331cd: 8329823: RISC-V: Need to sync CPU features with related JVM flags
  • 71c5bbc: 8329527: Opcode.IFNONNULL.primaryTypeKind() is not ReferenceType
  • 58e39c1: 8329884: Serial: Fix build failure due to ‘Copy’ has not been declared
  • 19a99d0: 8326744: Class-File API transition to Second Preview
  • b4dddde: 8329840: Fix ZPhysicalMemorySegment::_end type
  • dfaf11a: 8329898: Revert one use of markWord.is_unlocked back to is_neutral
  • fbc1e66: 8328181: C2: assert(MaxVectorSize >= 32) failed: vector length should be >= 32
  • a887fd2: 8316991: Reduce nullable allocation merges
  • e702646: 8200566: DistributionPointFetcher fails to fetch CRLs if the DistributionPoints field contains more than one DistributionPoint and the first one fails
  • ... and 38 more: https://git.openjdk.org/jdk/compare/0b01144ecec1283adaaaf1a7f53d075a56f030ae...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 rfr Pull request is ready for review label Apr 5, 2024
@openjdk
Copy link

openjdk bot commented Apr 5, 2024

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

  • net

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 net net-dev@openjdk.org label Apr 5, 2024
@mlbridge
Copy link

mlbridge bot commented Apr 5, 2024

Webrevs

* <p>
* The behaviour when {@link SocketOptions#SO_REUSEADDR SO_REUSEADDR} is
* The behaviour when {@link StandardSocketOptions#SO_REUSEADDR SO_REUSEADDR} is
Copy link
Contributor

Choose a reason for hiding this comment

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

I suppose the main question here is whether the description really needs to link to SO_REUSEADDR five times, it seems a bit excessive. In cases like this I tend to just have the first usage link, others do it differently.

Copy link
Member Author

Choose a reason for hiding this comment

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

Hello Alan, I too typically follow the process of linking once and then using {@code SO_REUSEADDR}. I let it stay in this form since it was already that way. I'll go ahead and update it to link only once.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done - I've updated the PR to remove the repeated links.

@@ -261,7 +261,7 @@ public ServerSocket(int port, int backlog) throws IOException {
* the specified range of valid port values, which is between
* 0 and 65535, inclusive.
*
* @see SocketOptions
* @see StandardSocketOptions
Copy link
Contributor

Choose a reason for hiding this comment

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

What would you think about dropping this link, and the link to SocketImpl from all the constructors, they aren't relevant for anyone reading this part of the docs.

Copy link
Member Author

@jaikiran jaikiran Apr 5, 2024

Choose a reason for hiding this comment

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

These constructors talk about the {@code createSocketImpl} method, so I'm guessing the @see java.net.SocketImpl was meant to provide reference to the SocketImpl. But I think we should just change the {@code createSocketImpl} method to {@link SocketImplFactory#createSocketImpl()} method and remove these @see java.net.SocketImpl.

I guess we could do the same and remove the @see java.net.SocketImpl from the constructors of java.net.Socket too?

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've now updated the PR with what I had in mind for this proposed change to these constructors.

* create the actual socket implementation. Otherwise a system-default
* factory, that {@linkplain SocketImplFactory#createSocketImpl()
* factory's createSocketImpl method} is called to create
* the actual socket implementation. Otherwise a system-default
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this would be better if you link "server socket implementation factory" to SocketImplFactory, and link "createSocketImpl" to the createSocketImpl 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.

Done - I've updated the PR with these changes to both ServerSocket and Socket class.

@@ -173,7 +173,8 @@ private Socket(Void unused, SocketImpl impl) {
* Creates an unconnected Socket.
* <p>
* If the application has specified a client socket implementation
* factory, that factory's {@code createSocketImpl} method is called to
* factory, that {@linkplain SocketImplFactory#createSocketImpl()
* factory's createSocketImpl method} is called to
Copy link
Contributor

Choose a reason for hiding this comment

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

Same comment as ServerSocket.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Apr 7, 2024
@dfuch
Copy link
Member

dfuch commented Apr 9, 2024

@jaikiran the only reservation I have is that the new wording makes it look like the default implementation of ServerSocket methods is going to call SocketImpl::getOption(SocketOption<>) while in fact it still calls SocketImpl::getOption(SocketOptions). But if @AlanBateman is good with that I am good as well. Maybe the fact that the two SocketImpl methods have equivalent results and that the implementation still call the legacy one should be spelled out in a public comment in the JBS issue? I am worrying about possible implication with JCK.

@AlanBateman
Copy link
Contributor

@jaikiran the only reservation I have is that the new wording makes it look like the default implementation of ServerSocket methods is going to call SocketImpl::getOption(SocketOption<>) while in fact it still calls SocketImpl::getOption(SocketOptions).

I think the proposal is okay. It just specifies that set/gets the socket options, it doesn't specify whether it calls the SocketImpl's setOption(int, Object) or setOption(SocketOption, Object) methods.

@jaikiran
Copy link
Member Author

jaikiran commented Apr 9, 2024

Thank you Alan and Daniel for the reviews.

@jaikiran
Copy link
Member Author

jaikiran commented Apr 9, 2024

/integrate

@openjdk
Copy link

openjdk bot commented Apr 9, 2024

Going to push as commit 635cb3c.
Since your change was applied there have been 53 commits pushed to the master branch:

  • 5c9f036: 8329858: G1: Make G1VerifyLiveAndRemSetClosure stateless
  • 492b954: 8329750: Change Universe functions to return more specific Klass* types
  • 87131fb: 8329629: GC interfaces should work directly against nmethod instead of CodeBlob
  • 5ea21c3: 8329878: Reduce public interface of CardTableBarrierSet
  • a48289a: 8329761: Remove unused KeyBuilder and unusedSets from StyleContext
  • 8907eda: 8325485: IncrementInstructions.of(int, int) is not storing the args
  • b9331cd: 8329823: RISC-V: Need to sync CPU features with related JVM flags
  • 71c5bbc: 8329527: Opcode.IFNONNULL.primaryTypeKind() is not ReferenceType
  • 58e39c1: 8329884: Serial: Fix build failure due to ‘Copy’ has not been declared
  • 19a99d0: 8326744: Class-File API transition to Second Preview
  • ... and 43 more: https://git.openjdk.org/jdk/compare/0b01144ecec1283adaaaf1a7f53d075a56f030ae...master

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Apr 9, 2024

@jaikiran Pushed as commit 635cb3c.

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

@jaikiran jaikiran deleted the 8329745 branch April 9, 2024 13:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
integrated Pull request has been integrated net net-dev@openjdk.org
Development

Successfully merging this pull request may close these issues.

3 participants