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

Jaikiran Pai jpai at openjdk.org
Wed May 15 04:51:03 UTC 2024


On Wed, 15 May 2024 04:20:09 GMT, Jaikiran Pai <jpai at openjdk.org> wrote:

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

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.

-------------

PR Comment: https://git.openjdk.org/jdk/pull/19242#issuecomment-2111577091


More information about the net-dev mailing list