RFR: 8356154: Respecify java.net.Socket constructors that allow creating UDP sockets to throw IllegalArgumentException

Jaikiran Pai jpai at openjdk.org
Mon May 5 10:18:07 UTC 2025


Can I please get a review of this change which proposes to respecify the 2 `java.net.Socket` constructors that allow construction of UDP sockets? This addresses https://bugs.openjdk.org/browse/JDK-8356154.

As noted in that JBS issue, in Java 23 we deprecated for removal the 2 `Socket` constructors that allowed UDP socket creation. The plan continues to be to remove those constructors. Before removing those, in order to allow for applications to notice this deprecation, these constructors are now being respecified to throw an `IllegalArgumentException` when the `stream` parameter is `false`.

I will create a CSR once we settle on these changes.

tier1 through tier8 tests have been run with this change and no related failures have been noticed.

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

Commit messages:
 - update apiNote on SocketImpl
 - 8356154: Respecify java.net.Socket constructors that allow creating UDP sockets to throw IllegalArgumentException

Changes: https://git.openjdk.org/jdk/pull/25031/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=25031&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8356154
  Stats: 156 lines in 9 files changed: 37 ins; 57 del; 62 mod
  Patch: https://git.openjdk.org/jdk/pull/25031.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/25031/head:pull/25031

PR: https://git.openjdk.org/jdk/pull/25031


More information about the net-dev mailing list