RFR: 8297519: Improve expressions and modernise code [v2]

Weijun Wang weijun at openjdk.org
Tue Nov 29 16:44:29 UTC 2022


On Mon, 28 Nov 2022 11:59:56 GMT, Per Minborg <pminborg at openjdk.org> wrote:

>> During the work of another PR (https://github.com/openjdk/jdk/pull/11260), several improvement areas were identified. These are now adressed in this separate PR proposing the use of more modern Java constructs as well as simplifying a large number of logical expressions that were previously non-normative. 
>> 
>> 
>> This branch has been tested and passed tier1-4 tests.
>
> Per Minborg has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Update from the first round of comments

Some small comments. I quickly went through all the changes and they look good. Some lines are a little too long, especially some exception throwing ones after `default ->`.

src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11AEADCipher.java line 375:

> 373:                     tagLen = type.defTagLen;
> 374:                 }
> 375:                 default -> throw new AssertionError("Unsupported type " + type);

`default` is unnecessary.

src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11KeyPairGenerator.java line 210:

> 208:                 if (params instanceof ECParameterSpec) {
> 209:                     ecParams = P11ECKeyFactory.getECParameterSpec(
> 210:                             (ECParameterSpec) params);

Do you want to eliminate this cast (and the one below) using an instanceof variable?

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

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


More information about the security-dev mailing list