On Fri, 10 May 2024 20:54:45 GMT, Kevin Driver <[email protected]> wrote:
>> src/java.base/share/classes/javax/crypto/spec/HKDFParameterSpec.java line 47:
>>
>>> 45: final class Builder {
>>> 46:
>>> 47: Extract extract = null;
>>
>> No need to store an `extract` field. Just create one and return it in
>> `extractOnly`.
>
> This field is required for checks in other functions.
This field is useless. Since the only place to create a builder is `return new
Builder().createExtract()` in the `extract()` method, the field is always non
null. But then when `exactOnly` is called you create a new one and return it.
And when `andExpand` is call, you only check if it's null (which never is).
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/18924#discussion_r1599084176