-
Type:
CSR
-
Resolution: Approved
-
Priority:
P4
-
Component/s: core-libs
-
None
-
source, behavioral
-
low
-
A corpus scan of around 196 million classes shows the usage of either of these 3 methods in only around 14 classes. The usage of these methods is thus very low and the impact of this change should be low too.
-
Java API
-
SE
Summary
The following methods on java.net.MulticastSocket which are currently deprecated, will now be deprecated for removal:
public byte getTTL() throws IOException
public void setTTL(byte ttl) throws IOException
public void send(DatagramPacket p, byte ttl) throws IOException
Similarly, the following methods on java.net.DatagramSocketImpl which too are currently deprecated will now be deprecated for removal:
protected abstract void setTTL(byte ttl) throws IOException;
protected abstract byte getTTL() throws IOException;
Problem
getTTL() and setTTL() methods on MulticastSocket have been deprecated since Java 1.2.2 (JDK-4148757) and the getTTL()/setTTL() methods on java.net.DatagramSocketImpl have been deprecated since Java 1.2 (https://bugs.openjdk.org/browse/JDK-4091012). The javadoc of those APIs already point users to alternative methods to use.
Similarly, the send(DatagramPacket, byte) method on MulticastSocket was deprecated in Java 1.4 (https://bugs.openjdk.org/browse/JDK-4190216). The javadoc of this method too already points users to the alternative method to use.
These methods are no longer necessary for the functioning of MulticastSocket or DatagramSocketImpl and should thus be deprecated for removal to allow for their removal in a future release.
Solution
These methods will be deprecated for removal.
Specification
diff --git a/src/java.base/share/classes/java/net/MulticastSocket.java b/src/java.base/share/classes/java/net/MulticastSocket.java
- @Deprecated
+ @Deprecated(forRemoval = true)
public void setTTL(byte ttl) throws IOException {
- @Deprecated
+ @Deprecated(forRemoval = true)
public byte getTTL() throws IOException {
- @Deprecated
+ @Deprecated(forRemoval = true)
public void send(DatagramPacket p, byte ttl)
throws IOException {
diff --git a/src/java.base/share/classes/java/net/DatagramSocketImpl.java b/src/java.base/share/classes/java/net/DatagramSocketImpl.java
- @Deprecated
+ @Deprecated(forRemoval = true, since = "1.2")
protected abstract void setTTL(byte ttl) throws IOException;
- @Deprecated
+ @Deprecated(forRemoval = true, since = "1.2")
protected abstract byte getTTL() throws IOException;
- csr of
-
JDK-8332181 Deprecate for removal the MulticastSocket.send(DatagramPacket, byte) and setTTL/getTTL methods on DatagramSocketImpl and MulticastSocket
-
- Resolved
-
- relates to
-
JDK-4148757 java.net.MulticastSocket.setTTL does not allow ttl=0
-
- Resolved
-