jdk icon indicating copy to clipboard operation
jdk copied to clipboard

8332181: Deprecate for removal the java.net.MulticastSocket.setTTL/getTTL and the 2-arg send methods

Open jaikiran opened this issue 1 year ago • 10 comments

Can I please get a review of this change which proposes to deprecate for removal 3 methods on java.net.MulticastSocket? This addresses https://bugs.openjdk.org/browse/JDK-8332181.

As noted in that issue these methods have been deprecated since Java 1.2 and 1.4 days. They currently have replacement methods (noted in their javadoc) which have been in use for several releases. This commit updates these deprecated methods to deprecated for removal, to allow for their removal in a future release.

No new tests have been added and existing tests in tier1, tier2 and tier3 continue to pass.


Progress

  • [x] Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • [x] Change must not contain extraneous whitespace
  • [ ] Change requires CSR request JDK-8332261 to be approved
  • [x] Commit message must refer to an issue

Issues

  • JDK-8332181: Deprecate for removal the java.net.MulticastSocket.setTTL/getTTL and the 2-arg send methods (Bug - P4)
  • JDK-8332261: Deprecate for removal the java.net.MulticastSocket.setTTL/getTTL and the 2-arg send methods (CSR)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 19242

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

Using diff file

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

Webrev

Link to Webrev Comment

jaikiran avatar May 15 '24 04:05 jaikiran

:wave: 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.

bridgekeeper[bot] avatar May 15 '24 04:05 bridgekeeper[bot]

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

8332181: Deprecate for removal the MulticastSocket.send(DatagramPacket, byte) and setTTL/getTTL methods on DatagramSocketImpl and MulticastSocket

Reviewed-by: dfuchs, iris, 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 3 new commits pushed to the master branch:

  • b78613b6813a85662fb2af2004d0b68002fe471d: 8332154: Memory leak in SynchronousQueue
  • 7652f9811bfddf08650b0c3277012074873deade: 8331885: C2: meet between unloaded and speculative types is not symmetric
  • d6b7f9b170b6ce4f7275cc7595b71b9a3e93c133: 8331851: Add specific regression leap year tests for Calendar.roll()

Please see this link for an up-to-date comparison between the source branch of this pull request and 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[bot] avatar May 15 '24 04:05 openjdk[bot]

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

  • net
  • nio

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.

openjdk[bot] avatar May 15 '24 04:05 openjdk[bot]

A CSR has been drafted for this change and is available for review here https://bugs.openjdk.org/browse/JDK-8332261.

jaikiran avatar May 15 '24 04:05 jaikiran

Webrevs

mlbridge[bot] avatar May 15 '24 04:05 mlbridge[bot]

Part of what makes Java so great is that you can take a Java 1 program and run it under Java 22? with no modifications?

What does it cost to keep these methods around?

robaho avatar May 15 '24 04:05 robaho

Hello Robert,

Part of what makes Java so great is that you can take a Java 1 program and run it under Java 22? with no modifications?

What does it cost to keep these methods around?

In this case, we do not want the applications to be using these methods. These methods accept a ttl value as byte. As noted in the javadoc of setTTL() method:

The ttl is an unsigned 8-bit quantity, and so must be in the range {@code 0 <= ttl <= 0xFF }

The byte type doesn't allow for these values to be accomodated. That's why those methods were deprecated very long back in favour of the ones noted in their javadoc.

jaikiran avatar May 15 '24 04:05 jaikiran

That makes sense - thanks. I agree it is very, very old - just wanted more to understand the rationale as even though Java has deprecated a lot - I am not aware of any core removals - but only anecdotally.

robaho avatar May 17 '24 01:05 robaho

Thank you Iris and Daniel for the reviews. I've moved the CSR to Finalized.

jaikiran avatar May 19 '24 04:05 jaikiran

I think DatagramSocketImpl.getTTL/setTTL will need to be deprecated for removal at the same time.

Also I assume @Deprecated can be dropped from DatagramSocketAdaptor and NetMulticastSocket, they just override or call the deprecated methods so should only need @SuppressWarnings("removal").

AlanBateman avatar May 19 '24 14:05 AlanBateman

Hello Alan,

I think DatagramSocketImpl.getTTL/setTTL will need to be deprecated for removal at the same time.

I have now updated the PR to deprecate for removal these methods too. I have updated the CSR to note this change.

Also I assume @deprecated can be dropped from DatagramSocketAdaptor and NetMulticastSocket, they just override or call the deprecated methods so should only need @SuppressWarnings("removal").

Done.

jaikiran avatar May 20 '24 05:05 jaikiran

Thank you everyone for the reviews. The CSR has been approved. I'll go ahead with the integration now.

jaikiran avatar May 21 '24 06:05 jaikiran

/integrate

jaikiran avatar May 21 '24 06:05 jaikiran

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

  • f5ab7dff402a3152f5d5736cc6521b4be617eccf: 8332494: java/util/zip/EntryCount64k.java failing with java.lang.RuntimeException: '\A\Z' missing from stderr
  • 9f7779305c4ccbb86bb0e6d0ed8bc92a4b8f3b9d: 8332495: java/util/logging/LoggingDeadlock2.java fails with AssertionError: Some tests failed
  • fb45bab8e15d7dc59fe801922d768d377d3f44cd: 8075917: The regression-swing case failed as the text on label is not painted red with the GTK L&F
  • 6e805127f8091d46205165746d7c59a40703958d: 8332545: Fix handling of HTML5 entities in Markdown comments
  • b78613b6813a85662fb2af2004d0b68002fe471d: 8332154: Memory leak in SynchronousQueue
  • 7652f9811bfddf08650b0c3277012074873deade: 8331885: C2: meet between unloaded and speculative types is not symmetric
  • d6b7f9b170b6ce4f7275cc7595b71b9a3e93c133: 8331851: Add specific regression leap year tests for Calendar.roll()

Your commit was automatically rebased without conflicts.

openjdk[bot] avatar May 21 '24 06:05 openjdk[bot]

@jaikiran Pushed as commit ce99198e3a6dc81865c518b1fe4a67e93b8ebdd1.

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

openjdk[bot] avatar May 21 '24 06:05 openjdk[bot]