> 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.

Roger Riggs has updated the pull request incrementally with two additional 
commits since the last revision:

 - Refactor ensureCapacityNewCoder to compute newCapacity first and
   add an assert to check the count of characters fit within the new capacity.
   The same and different coder paths had slightly different computations for 
newCapacity.
 - Add a test exercising the buffer capacity changes during SB.replace.

-------------

Changes:
  - all: https://git.openjdk.org/jdk/pull/24967/files
  - new: https://git.openjdk.org/jdk/pull/24967/files/1404fa9e..8f731431

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=24967&range=07
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=24967&range=06-07

  Stats: 72 lines in 2 files changed: 56 ins; 8 del; 8 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

Reply via email to