On Wed, 20 Dec 2023 20:25:07 GMT, Jim Laskey <[email protected]> wrote:
> The new repeat methods were not clearing the toStringCache.
src/java.base/share/classes/java/lang/StringBuffer.java line 719:
> 717: public synchronized StringBuffer repeat(int codePoint, int count) {
> 718: super.repeat(codePoint, count);
> 719: toStringCache = null;
The other cases in StringBuffer clear toStringCache *before* performing the
modification.
For consistency, I'd suggest doing the same.
src/java.base/share/classes/java/lang/StringBuffer.java line 731:
> 729: public synchronized StringBuffer repeat(CharSequence cs, int count) {
> 730: super.repeat(cs, count);
> 731: toStringCache = null;
Ditto, clear toStringCache before the modification.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/17172#discussion_r1433218351
PR Review Comment: https://git.openjdk.org/jdk/pull/17172#discussion_r1433218688