8322512: StringBuffer.repeat does not work correctly after toString() was called

Reviewed-by: rriggs, jpai
This commit is contained in:
Jim Laskey 2024-01-04 12:46:31 +00:00
parent c3cd1f1814
commit df22fb322e
2 changed files with 16 additions and 1 deletions

View file

@ -715,6 +715,7 @@ import jdk.internal.vm.annotation.IntrinsicCandidate;
*/
@Override
public synchronized StringBuffer repeat(int codePoint, int count) {
toStringCache = null;
super.repeat(codePoint, count);
return this;
}
@ -726,6 +727,7 @@ import jdk.internal.vm.annotation.IntrinsicCandidate;
*/
@Override
public synchronized StringBuffer repeat(CharSequence cs, int count) {
toStringCache = null;
super.repeat(cs, count);
return this;
}