On Tue, 6 May 2025 16:18:11 GMT, Chen Liang <li...@openjdk.org> wrote:
>> Roger Riggs has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Apply reviewer suggestions for typos, javadoc, and copyright dates. > > src/java.base/share/classes/java/lang/AbstractStringBuilder.java line 270: > >> 268: private static byte[] ensureCapacityNewCoder(byte[] value, byte >> coder, int count, >> 269: int minimumCapacity, >> byte newCoder) { >> 270: assert coder == newCoder || newCoder == UTF16 : "bad new coder >> UTF16 -> LATIN1"; > > I recommend an additional assertion `count <= minimumCapacity`; even though > all callers ensure this currently, in case this is accidentally violated, we > are sending dangerous arguments to `StringLatin1.inflate`. > > Also, the message string of assertion can include the `coder` and `newCoder` > values. Same for the other assertions we add. Added the assertion(s) without the extra message formatting overhead/codesize. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/24967#discussion_r2081918105