RFR: 8375183: Remove unused SSLConfiguration.maximumProtocolVersion variable
Daniel Jeliński
djelinski at openjdk.org
Wed Jan 14 08:03:39 UTC 2026
On Wed, 14 Jan 2026 04:06:01 GMT, Koushik Muthukrishnan Thirupattur <duke at openjdk.org> 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
More information about the security-dev
mailing list