Skip to content

Commit 349ff6e

Browse files
authored
Merge pull request #19347 from pshipton/latin10.44-0.45
(0.45) jdk11 should create LATIN1 String constants
2 parents fe43095 + a19c19b commit 349ff6e

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

runtime/gc_base/StringTable.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -576,7 +576,7 @@ j9gc_createJavaLangString(J9VMThread *vmThread, U_8 *data, UDATA length, UDATA s
576576
for (UDATA i = 0; i < unicodeLength; ++i) {
577577
if (unicodeData[i] > 0x7F) {
578578
isASCII = false;
579-
if (J2SE_VERSION(vm) >= J2SE_V17) {
579+
if (J2SE_VERSION(vm) >= J2SE_V11) {
580580
for (UDATA j = i; j < unicodeLength; ++j) {
581581
if (unicodeData[j] > 0xFF) {
582582
isASCIIorLatin1 = false;
@@ -604,7 +604,7 @@ j9gc_createJavaLangString(J9VMThread *vmThread, U_8 *data, UDATA length, UDATA s
604604
continue;
605605
}
606606
isASCII = false;
607-
if (compressStrings && (J2SE_VERSION(vm) >= J2SE_V17)) {
607+
if (compressStrings && (J2SE_VERSION(vm) >= J2SE_V11)) {
608608
U_8 *dataTmp = data + i;
609609
UDATA lengthTmp = length - i;
610610
isASCIIorLatin1 = VM_VMHelpers::isLatin1String(dataTmp, lengthTmp);

test/functional/Java8andUp/src/org/openj9/test/java/lang/Test_String.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -932,8 +932,11 @@ public void test_indexOf2() {
932932
*/
933933
@Test
934934
public void test_indexOf3() {
935-
AssertJUnit.assertTrue("Failed to find string", hw1.indexOf("World") > 0);
936-
AssertJUnit.assertTrue("Failed to find string", !(hw1.indexOf("ZZ") > 0));
935+
AssertJUnit.assertEquals("Failed to find string 1", 5, hw1.indexOf("World"));
936+
AssertJUnit.assertEquals("Failed to find string 2", -1, hw1.indexOf("ZZ"));
937+
String needle = "\u00b0\u00b1";
938+
String hay = new StringBuilder("a").append(needle).toString();
939+
AssertJUnit.assertEquals("Failed to find string 3", 1, hay.indexOf(needle));
937940
}
938941

939942
/**

0 commit comments

Comments
 (0)