RFR: JDK-8322512 StringBuffer.repeat does not work correctly after toString() was called [v2]
Jim Laskey
jlaskey at openjdk.org
Wed Dec 20 22:18:08 UTC 2023
On Wed, 20 Dec 2023 21:52:40 GMT, Roger Riggs <rriggs at openjdk.org> wrote:
>> Jim Laskey has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Clear sooner
>
> 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.
Changed
> 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.
Changed
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/17172#discussion_r1433234794
PR Review Comment: https://git.openjdk.org/jdk/pull/17172#discussion_r1433234928
More information about the core-libs-dev
mailing list