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

Mark Powers mpowers at openjdk.org
Wed Sep 7 00:00:00 UTC 2022


On Tue, 6 Sep 2022 22:37:21 GMT, Mark Powers <mpowers at openjdk.org> wrote:

>> src/java.base/share/classes/sun/security/provider/certpath/CertId.java line 226:
>> 
>>> 224:                 "\nissuerKeyHash: \n" +
>>> 225:                 encoder.encode(issuerKeyHash) +
>>> 226:                 "\n" + certSerialNumber.toString();
>> 
>> I believe this creates more `String` objects whereas the previous code used a mutable `StringBuilder` to build up the `String` first. Not sure this code is better, even though this is probably not a commonly called method.
>
> If the new code requires more work (CPU and memory) then maybe it is not a good idea. I'll try to find out more about this method before I revert the change.

Under the hood, the java compiler uses `StringBuilder` so the new code is okay. I looked at the byte code.

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

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



More information about the security-dev mailing list