On Wed, 30 Apr 2025 14:12:36 GMT, Roger Riggs <rri...@openjdk.org> wrote:
> Refactor AbstractStringBuilder to maintain consistency among count, coder, > and value buffers while the buffer capacity is being expanded and/or inflated > from Latin1 to UTF16 representations. > The refactoring pattern is to read and write AbstractStringBuilder fields > once using locals for all intermediate values. > Support methods are static, designed to pass all values as arguments and > return a value. > > The value byte array is reallocated under 3 conditions: > - Increasing the capacity with the same encoder > - Increasing the capacity and inflation to change the coder from LATIN1 to > UTF16 > - Inflation with the same capacity > > Added StressSBTest to exercise public instance methods of StringBuilder. src/java.base/share/classes/java/lang/AbstractStringBuilder.java line 1868: > 1866: > 1867: final boolean isLatin1() { > 1868: return COMPACT_STRINGS && coder == LATIN1; Suggestion: return isLatin1(coder); Can we reuse static isLatin1 like this? ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/24967#discussion_r2068986449