RFR: JDK-8291509 Minor cleanup could be done in sun.security

Mark Powers mpowers at openjdk.org
Fri Aug 26 18:04:57 UTC 2022


On Fri, 26 Aug 2022 17:46:44 GMT, Valerie Peng <valeriep at openjdk.org> wrote:

>> Right, but in this case I think if an NPE is ever thrown it would be considered a bug in the JDK because an unexpected RuntimeException would be thrown. I think requireNonNull is used more in cases where caller input is being validated and null is not valid. I find this code less readable. There are lots of cases in the JDK code where some object could theoretically be null, but it would be a bug if it was. If it was a normal case for a provider to sometimes be null here, then I would expect this code to check for null and handle it.
>> 
>> @valeriep is more familiar with this code, so I would also like her feedback on these changes to use requireNonNull.
>
> I don't see much benefit of using Objects.requireNonNull() here also for the reasons that Sean have already stated.

@valeriepeng agrees with you Sean. I'll remove `requireNonNull` here and elsewhere unless there is a compelling reason to keep it.

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

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



More information about the security-dev mailing list