[jdk16] RFR: 8260927: StringBuilder::insert is incorrect without Compact Strings

Aleksey Shipilev shade at openjdk.java.net
Tue Feb 2 13:18:56 UTC 2021


Discovered it with ARM32 tier1 tests, which runs with -CompactStrings by default. But the bug is actually generic:

$ CONF=linux-x86_64-server-fastdebug make run-test TEST=java/lang/StringBuilder/Insert.java TEST_VM_OPTS="-XX:-CompactStrings"

test Insert.insertOffset(): failure
java.lang.AssertionError: expected [??abc] but found [efabc]
	at org.testng.Assert.fail(Assert.java:94)
	at org.testng.Assert.failNotEquals(Assert.java:496)
	at org.testng.Assert.assertEquals(Assert.java:125)
	at org.testng.Assert.assertEquals(Assert.java:178)
	at org.testng.Assert.assertEquals(Assert.java:188)
	at Insert.insertOffset(Insert.java:45)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

I believe this is a regression from [JDK-8254082](https://bugs.openjdk.java.net/browse/JDK-8254082). 

Additional testing:
 - [x] Linux x86_64 `tier1` default, passes
 - [x] Linux x86_64 `tier1`, `-XX:-CompactStrings`, passes modulo two testbugs ([JDK-8260933](https://bugs.openjdk.java.net/browse/JDK-8260933), [JDK-8260934](https://bugs.openjdk.java.net/browse/JDK-8260934))
 - [x] Linux ARM32, affected test now passes

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

Commit messages:
 - 8260927: StringBuilder::insert is incorrect without Compact Strings

Changes: https://git.openjdk.java.net/jdk16/pull/143/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk16&pr=143&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8260927
  Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod
  Patch: https://git.openjdk.java.net/jdk16/pull/143.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk16 pull/143/head:pull/143

PR: https://git.openjdk.java.net/jdk16/pull/143


More information about the core-libs-dev mailing list