On Tue, 5 Dec 2023 14:57:09 GMT, Jim Laskey <jlas...@openjdk.org> wrote:
> A regression is found in Java9+ creating String instance from UTF8 bytes, a > side effect of string compactation https://openjdk.org/jeps/254 that changed > the decoding logic. Specifically, when constructing a string from bytes: > > ``` > String str = new String(largeBytes, StandardCharsets.UTF_8); > ``` > > if the size of largeBytes is greater than 2^30 (>1 GB) but smaller than > INT_MAX (2 GB), it fails on Java9+ (including 11, 17, 21, though the stack > trace is slightly different, see below), regardless of jvm heap size. In > Java8, it succeeded when jvm heap size is set to be sufficient. Changes requested by rriggs (Reviewer). test/jdk/java/lang/String/CompactString/NegativeSize.java line 36: > 34: > 35: public class NegativeSize { > 36: Why is there a `public class Main` inside `public class NegativeSize`? The `@run testng/othervm` would indicate a testng test but there are no `@Test` annotations and/or the tests in NegativeSize.Main. ------------- PR Review: https://git.openjdk.org/jdk/pull/16974#pullrequestreview-1765972981 PR Review Comment: https://git.openjdk.org/jdk/pull/16974#discussion_r1416195950