The documentation for java.net.SocketOptions.SO_LINGER doesn't explain that the value type for this option is either an Integer or a Boolean. We should update it to make it clear.
As noted by Alan in a PR ( https://git.openjdk.org/jdk/pull/18645#discussion_r1554833351 ):
> One thing to mention about SO_LINGER is that the value of this socket option is an Integer when enabling and a Boolean when disabling. The getter works the same way. AFAIK, this was never correctly specified in SocketOptions.SO_LINGER but the examples in the setOption/getOption API docs include disabling. To notice this would require something to use a custom SocketImpl of course. So I think we need a follow-up to the change here to say that the value is Boolean.FALSE to disable (or disabled), otherwise an Integer with the linger timeout.
As noted by Alan in a PR ( https://git.openjdk.org/jdk/pull/18645#discussion_r1554833351 ):
> One thing to mention about SO_LINGER is that the value of this socket option is an Integer when enabling and a Boolean when disabling. The getter works the same way. AFAIK, this was never correctly specified in SocketOptions.SO_LINGER but the examples in the setOption/getOption API docs include disabling. To notice this would require something to use a custom SocketImpl of course. So I think we need a follow-up to the change here to say that the value is Boolean.FALSE to disable (or disabled), otherwise an Integer with the linger timeout.
- csr for
-
JDK-8332512 Clarify the value type for java.net.SocketOptions.SO_LINGER
- Closed