-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
8332181: Deprecate for removal the MulticastSocket.send(DatagramPacket, byte) and setTTL/getTTL methods on DatagramSocketImpl and MulticastSocket #19242
Conversation
…tTTL and the 2-arg send methods
👋 Welcome back jpai! A progress list of the required criteria for merging this PR into |
@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:
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
Please see this link for an up-to-date comparison between the source branch of this pull request and the ➡️ To integrate this PR with the above commit message to the |
A CSR has been drafted for this change and is available for review here https://bugs.openjdk.org/browse/JDK-8332261. |
Webrevs
|
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? |
Hello Robert,
In this case, we do not want the applications to be using these methods. These methods accept a
The |
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. |
@@ -652,6 +652,7 @@ public Set<SocketOption<?>> supportedOptions() { | |||
|
|||
@Deprecated | |||
@Override | |||
@SuppressWarnings("removal") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of adding @SuppressWarning("removal")
here (and at other places below) - would it make sense to update the @Deprecated
annotation and add forRemoval = true
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We will still have to add the @SuppressWarning("removal")
to these methods otherwise the compilation generates a warning which fails the build:
java.base/share/classes/java/net/NetMulticastSocket.java:655: warning: [removal] setTTL(byte) in MulticastSocket has been deprecated and marked for removal
public void setTTL(byte ttl) throws IOException {
^
java.base/share/classes/java/net/NetMulticastSocket.java:673: warning: [removal] getTTL() in MulticastSocket has been deprecated and marked for removal
public byte getTTL() throws IOException {
^
error: warnings found and -Werror specified
1 error
2 warnings
I went ahead and updated these internal NetMulticastSocket
and DatagramSocketAdaptor
classes to add the forRemoval
attribute to the @Deprecated
annotation to keep it consistent.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah - thank you. I had hoped that adding forRemoval = true to the annotation would allow us to get rid of the SuppressWarning.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From the JCP POV, these changes look fine. These changes match the associated CSR, which I've also Reviewed.
Thank you Iris and Daniel for the reviews. I've moved the CSR to Finalized. |
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 |
Hello Alan,
I have now updated the PR to deprecate for removal these methods too. I have updated the CSR to note this change.
Done. |
Thank you everyone for the reviews. The CSR has been approved. I'll go ahead with the integration now. |
/integrate |
Going to push as commit ce99198.
Your commit was automatically rebased without conflicts. |
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
Issues
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