8365887: Outdated comments in String::decode

Reviewed-by: liach, sherman
This commit is contained in:
April Ivy 2026-06-26 06:32:10 +00:00 committed by SendaoYan
parent 60e4b91f61
commit 38ee41bee3

View File

@ -671,14 +671,6 @@ public final class String
}
private static String decode(Charset charset, byte[] bytes, int offset, int length) {
// (1)We never cache the "external" cs, the only benefit of creating
// an additional StringDe/Encoder object to wrap it is to share the
// de/encode() method. These SD/E objects are short-lived, the young-gen
// gc should be able to take care of them well. But the best approach
// is still not to generate them if not really necessary.
// (2)The defensive copy of the input byte/char[] has a big performance
// impact, as well as the outgoing result byte/char[]. Need to do the
// optimization check of (sm==null && classLoader0==null) for both.
CharsetDecoder cd = charset.newDecoder();
// ArrayDecoder fastpaths
if (cd instanceof ArrayDecoder ad) {