RFR: 8289274: Cleanup unnecessary null comparison before instanceof check in security modules

Sean Mullan mullan at openjdk.org
Wed Jul 6 15:21:28 UTC 2022


On Wed, 6 Jul 2022 15:12:06 GMT, Andrey Turbanov <aturbanov at openjdk.org> wrote:

>> src/java.base/share/classes/sun/security/provider/certpath/RevocationChecker.java line 491:
>> 
>>> 489:                 break;
>>> 490:             case "SSLServer":
>>> 491:                 result = (t instanceof IOException);
>> 
>> Suggestion:
>> 
>>                 result = t instanceof IOException;
>
> I like current approach with parentheses when `instanceof` is involved. Especially with assignment. In this case you can clearly see start and end of expression which would be assigned to variable.
> @seanjmullan what do you think?

I agree. It helps with the readability of the code.

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

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



More information about the security-dev mailing list