On Fri, 18 Sep 2026 12:04:48 GMT, Lee Jiwon <[email protected]> wrote:

>> Before this change, Sockets.supportedOptions(Class<?>) used a hard-coded 
>> option map created during class initialization. The reported set could 
>> differ from the options supported by an actual socket instance.
>> 
>> This change creates an instance of the requested socket type for each call 
>> and returns its supportedOptions() result. The temporary socket is closed 
>> after use, and jdk.net.Sockets does not cache the result. The hard-coded 
>> option map and helper code used only to build that map are removed.
>> 
>> Testing:
>> 
>> * make test TEST=test/jdk/jdk/net/Sockets/SupportedOptions.java
>> * make test TEST=test/jdk/jdk/net/Sockets
>> * make test TEST=jdk_net — 1,082 tests passed
>> 
>> ---------
>> - [x] I confirm that I make this contribution in accordance with the 
>> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai).
>
> Lee Jiwon has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   8392528: Use UncheckedIOException for socket creation failures

test/jdk/jdk/net/Sockets/SupportedOptions.java line 62:

> 60:     void invalidSocketTypes() {
> 61:         assertThrows(IllegalArgumentException.class, () -> 
> Sockets.supportedOptions(null));
> 62:         assertThrows(IllegalArgumentException.class, () -> 
> Sockets.supportedOptions(String.class));

Sockets.supportedOptions doesn't specify how it handles null to testing long 
standing behavior is okay.

test/jdk/jdk/net/Sockets/SupportedOptions.java line 66:

> 64: 
> 65:     @Test
> 66:     void serverSocketSupportsIpTos() throws Exception {

The test is now a unit test for Sockets.supportedOptions so I think this one 
looks a bit out of places. Is it needed? It looks like 
SocketOpotion/OptionTest.java tests setting IP_TOS on ServerSOcket.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/32943#discussion_r4047834896
PR Review Comment: https://git.openjdk.org/jdk/pull/32943#discussion_r4047872764

Reply via email to