File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed
test/hotspot/jtreg/runtime/jni/checked Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -44,9 +44,14 @@ public class TestLargeUTF8Length {
44
44
static native void checkUTF8Length (String s , long utf8Length );
45
45
46
46
static void test () {
47
- int length = Integer .MAX_VALUE /2 + 1 ;
48
- char character = (char )0XD1 ; // N with tilde
49
- long utf8Length = 2L * length ;
47
+ // We want a string whose UTF-8 length is > Integer.MAX_VALUE, but
48
+ // whose "natural" length is < Integer.MAX_VALUE/2 so it can be
49
+ // created regardless of whether compact-strings are enabled or not.
50
+ // So we use a character that encodes as 3-bytes in UTF-8.
51
+ // U+08A0 : e0 a2 a0 : ARABIC LETTER BEH WITH SMALL V BELOW
52
+ char character = '\u08A0' ;
53
+ int length = Integer .MAX_VALUE /2 - 1 ;
54
+ long utf8Length = 3L * length ;
50
55
char [] chrs = new char [length ];
51
56
Arrays .fill (chrs , character );
52
57
String s = new String (chrs );
You can’t perform that action at this time.
0 commit comments