RFR: JDK-8322512 StringBuffer.repeat does not work correctly after toString() was called [v2]

Jaikiran Pai jpai at openjdk.org
Thu Dec 21 07:58:49 UTC 2023


On Wed, 20 Dec 2023 22:18:08 GMT, Jim Laskey <jlaskey at openjdk.org> wrote:

>> The new repeat methods were not clearing the toStringCache.
>
> Jim Laskey has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Clear sooner

The changes look good to me. I just have a minor comment about the `assertEquals` usage which I've added inline.

test/jdk/java/lang/StringBuilder/StringBufferRepeat.java line 138:

> 136:         sb.repeat('*', 5);
> 137:         expected = "*****";
> 138:         assertEquals(expected, sb.toString());

Hello Jim, just a minor detail - in case of testng's `Assert.assertEquals()` the first param is the `actual` and the second is the `expected`. Some other existing usages of this method in this test also have the incorrect order.

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

Marked as reviewed by jpai (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/17172#pullrequestreview-1792409092
PR Review Comment: https://git.openjdk.org/jdk/pull/17172#discussion_r1433678563


More information about the core-libs-dev mailing list