On Fri, 14 Jul 2023 05:06:14 GMT, Anthony Scarpino <ascarp...@openjdk.org> wrote:
>> Valerie Peng has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Address review feedbacks, e.g. Removed RSAPadding.Output and use byte[] as >> before. > > src/java.base/share/classes/com/sun/crypto/provider/RSACipher.java line 349: > >> 347: byte[] result = null; >> 348: try { >> 349: switch (mode) { > > Nothing wrong what you did here, but since you used the new style switch > elsewhere, you could do: > > return switch(mode) { > case MODE_SIGN -> { > paddingCopy = padding.pad(buffer, 0, bufOfs); > if (paddingCopy == null) { > throw new BadPaddingException("Padding error in signing"); > } > yield RSACore.rsa(paddingCopy, privateKey, true); > } > > ... and so on... In code that would probably need to be back ported, I would not use language features that might not be available in earlier versions (I don't know whether this is the case here, though) unless they provide noticeable performance benefits, not just "look better/more modern". ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14839#discussion_r1263683279