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

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

Commit messages:
 - 8392528: Use socket instances for Sockets.supportedOptions

Changes: https://git.openjdk.org/jdk/pull/32943/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=32943&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8392528
  Stats: 210 lines in 2 files changed: 49 ins; 144 del; 17 mod
  Patch: https://git.openjdk.org/jdk/pull/32943.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/32943/head:pull/32943

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

Reply via email to