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. ------------- Commit messages: - 8351443: Refactor AbstractStringBuilder to maintain consistency between Changes: https://git.openjdk.org/jdk/pull/24967/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=24967&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8351443 Stats: 885 lines in 7 files changed: 655 ins; 55 del; 175 mod Patch: https://git.openjdk.org/jdk/pull/24967.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/24967/head:pull/24967 PR: https://git.openjdk.org/jdk/pull/24967