On Wed, 14 Jan 2026 04:06:01 GMT, Koushik Muthukrishnan Thirupattur <[email protected]> wrote:
>> We don't need null checks, `protocolVersion` currently is not used before >> it's set to the negotiated protocol, and we'll get a NPE if somebody tries >> to use it before it's set. It is basically a representation of negotiated >> protocol in `TransportContext`. > > In that case, instead of leaving it null, can we consider initializing > protocolVersion to ProtocolVersion.NONE with a short comment? That would > avoid using null as state and make the intent more explicit/readable. That would be more risky; any uninitialized use is a bug, and null pointer exceptions are easier to spot. The protocol version is set to the maximum active protocol [here](https://github.com/openjdk/jdk/blob/1b6c2bdd7b57891ed35e3c067871d2c0bf282824/src/java.base/share/classes/sun/security/ssl/HandshakeContext.java#L253), which is still long before the variable is used. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/29192#discussion_r2689374894
