On Tue, 28 May 2024 22:08:06 GMT, Pavel Rappo <pra...@openjdk.org> wrote:
>> Yes, should be `2` (`a` is semantically a `char[]`). This typo likely pass >> functional testing since `1` can never happen in practice, and the default >> case should work for any value. There might be a String microbenchmark out >> there that might be slightly unhappy, though. > > I believe, it should be `1`. Hear me out. In this method, the `length` is > scaled down, whereas in `StringUTF16` it is not. In this method, it's > `length`, in `StringUTF16` it's `((byte[]) value).length`. In fact, if I change it to `2`, the following tests will fail: - `jdk/jdk/classfile/Utf8EntryTest.java` - `jdk/java/util/zip/ZipCoding.java` - `jdk/java/text/Format/MessageFormat/MessageRegression.java` ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/19414#discussion_r1617950633