On Wed, 1 Oct 2025 14:57:30 GMT, Adam Sotona <[email protected]> wrote:
>> Chen Liang has updated the pull request with a new target base due to a >> merge or a rebase. The pull request now contains 13 commits: >> >> - Redundant changes, improve stuff >> - Stage >> - Merge branch 'master' of https://github.com/openjdk/jdk into >> feature/cf-utf8-length-early >> - Merge branch 'master' of https://github.com/openjdk/jdk into >> feature/cf-utf8-length-early >> - Merge branch 'master' of https://github.com/openjdk/jdk into >> feature/cf-utf8-length-early >> - Stage >> - Merge branch 'master' of https://github.com/openjdk/jdk into >> feature/cf-utf8-length-early >> - Merge branch 'master' of https://github.com/openjdk/jdk into >> feature/cf-utf8-length-early >> - Merge branch 'master' of https://github.com/openjdk/jdk into >> feature/cf-utf8-length-early >> - Avoid being too specific >> - ... and 3 more: https://git.openjdk.org/jdk/compare/58b601ac...8973a15d > > src/java.base/share/classes/jdk/internal/classfile/impl/AbstractPoolEntry.java > line 160: > >> 158: if (!ModifiedUtf.isValidLengthInConstantPool(s)) { >> 159: throw new IllegalArgumentException("utf8 length out of >> range of u2: " + ModifiedUtf.utfLen(s)); >> 160: } > > There might be multiple Utf8EntryImpl instances created and later reduced > into a single entry to write, so the check performed here might be redundant. I still think this is necessary. Most of the time, for strings with length < 20000, the check is almost trivial. Throwing an exception here provides a more useful stack trace about where the long string is first created, compared to a later exception which is harder to trace. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/27281#discussion_r2528957813
