8260927: StringBuilder::insert is incorrect without Compact Strings

Reviewed-by: redestad, alanb, rriggs, jlaskey
This commit is contained in:
Aleksey Shipilev 2021-02-02 18:00:43 +00:00
parent ed1a7755c3
commit 081fa3e715
2 changed files with 3 additions and 2 deletions

View file

@ -3621,7 +3621,7 @@ public final class String
*/
void getBytes(byte[] dst, int srcPos, int dstBegin, byte coder, int length) {
if (coder() == coder) {
System.arraycopy(value, srcPos, dst, dstBegin << coder, length << coder());
System.arraycopy(value, srcPos << coder, dst, dstBegin << coder, length << coder);
} else { // this.coder == LATIN && coder == UTF16
StringLatin1.inflate(value, srcPos, dst, dstBegin, length);
}