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

Eirik Bjørsnøs eirbjo at openjdk.org
Mon May 5 12:13:46 UTC 2025


On Mon, 5 May 2025 11:07:28 GMT, Jaikiran Pai <jpai at openjdk.org> wrote:

>> 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.
>
> Jaikiran Pai has updated the pull request incrementally with one additional commit since the last revision:
> 
>   review suggestion - throw IOException

src/java.base/share/classes/java/net/SocketImpl.java line 85:

> 83:      * @apiNote
> 84:      * The {@link Socket} constructors to create a datagram socket
> 85:      * are deprecated for removal and have been respecified to throw

This seems to talk about past, current and future behavior.

I thought we try to keep specifications focused on current behavior, with the exception of deprecation warnings.

Would it be possible to reword this without mentioning the past, avoiding the “have been respecified” part?

Interested users can always use release notes to observe history..?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/25031#discussion_r2073324977


More information about the net-dev mailing list