Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
8260927: StringBuilder::insert is incorrect without Compact Strings
Reviewed-by: redestad, alanb, rriggs, jlaskey
  • Loading branch information
shipilev committed Feb 2, 2021
1 parent ed1a775 commit 081fa3e7154db433b10b940ff223fd3d50099521
@@ -3621,7 +3621,7 @@ void getBytes(byte[] dst, int dstBegin, byte coder) {
*/
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);
}
@@ -27,9 +27,10 @@

/**
* @test
* @run testng Insert
* @bug 4914802 8257511
* @summary Test StringBuilder.insert sanity tests
* @run testng/othervm -XX:-CompactStrings Insert
* @run testng/othervm -XX:+CompactStrings Insert
*/
@Test
public class Insert {

1 comment on commit 081fa3e

@openjdk-notifier

This comment has been minimized.

Copy link

@openjdk-notifier openjdk-notifier bot commented on 081fa3e Feb 2, 2021

Please sign in to comment.