Re: RFR: JDK-8322512 StringBuffer.repeat does not work correctly after toString() was called [v2]
On Thu, 21 Dec 2023 07:55:50 GMT, Jaikiran Pai wrote: >> Jim Laskey has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Clear sooner > > 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. Updated - PR Review Comment: https://git.openjdk.org/jdk/pull/17172#discussion_r1441707877
Re: RFR: JDK-8322512 StringBuffer.repeat does not work correctly after toString() was called [v4]
> 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: Nit in test - Changes: - all: https://git.openjdk.org/jdk/pull/17172/files - new: https://git.openjdk.org/jdk/pull/17172/files/33dd7973..ec72e77c Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=17172&range=03 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=17172&range=02-03 Stats: 2 lines in 1 file changed: 0 ins; 0 del; 2 mod Patch: https://git.openjdk.org/jdk/pull/17172.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/17172/head:pull/17172 PR: https://git.openjdk.org/jdk/pull/17172
Re: RFR: JDK-8322512 StringBuffer.repeat does not work correctly after toString() was called [v3]
> The new repeat methods were not clearing the toStringCache. Jim Laskey has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains three additional commits since the last revision: - Merge remote-tracking branch 'upstream/master' into 8322512 - Clear sooner - Clear toStringCache when calling StringBuffer::repeat - Changes: - all: https://git.openjdk.org/jdk/pull/17172/files - new: https://git.openjdk.org/jdk/pull/17172/files/66eb7f71..33dd7973 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=17172&range=02 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=17172&range=01-02 Stats: 3615 lines in 286 files changed: 2156 ins; 564 del; 895 mod Patch: https://git.openjdk.org/jdk/pull/17172.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/17172/head:pull/17172 PR: https://git.openjdk.org/jdk/pull/17172
Re: RFR: JDK-8322512 StringBuffer.repeat does not work correctly after toString() was called [v2]
On Wed, 20 Dec 2023 22:18:08 GMT, Jim Laskey 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
Re: RFR: JDK-8322512 StringBuffer.repeat does not work correctly after toString() was called [v2]
On Wed, 20 Dec 2023 21:52:40 GMT, Roger Riggs 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
Re: RFR: JDK-8322512 StringBuffer.repeat does not work correctly after toString() was called [v2]
> 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 - Changes: - all: https://git.openjdk.org/jdk/pull/17172/files - new: https://git.openjdk.org/jdk/pull/17172/files/82b7e342..66eb7f71 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=17172&range=01 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=17172&range=00-01 Stats: 4 lines in 1 file changed: 2 ins; 2 del; 0 mod Patch: https://git.openjdk.org/jdk/pull/17172.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/17172/head:pull/17172 PR: https://git.openjdk.org/jdk/pull/17172
Re: RFR: JDK-8322512 StringBuffer.repeat does not work correctly after toString() was called [v2]
On Wed, 20 Dec 2023 22:15:04 GMT, Jim Laskey 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 LGTM. - Marked as reviewed by mk...@github.com (no known OpenJDK username). PR Review: https://git.openjdk.org/jdk/pull/17172#pullrequestreview-1791741679
Re: RFR: JDK-8322512 StringBuffer.repeat does not work correctly after toString() was called [v2]
On Wed, 20 Dec 2023 22:15:04 GMT, Jim Laskey 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 LGTM - Marked as reviewed by rriggs (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/17172#pullrequestreview-1791741828
Re: RFR: JDK-8322512 StringBuffer.repeat does not work correctly after toString() was called
On Wed, 20 Dec 2023 20:25:07 GMT, Jim Laskey 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
RFR: JDK-8322512 StringBuffer.repeat does not work correctly after toString() was called
The new repeat methods were not clearing the toStringCache. - Commit messages: - Clear toStringCache when calling StringBuffer::repeat Changes: https://git.openjdk.org/jdk/pull/17172/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=17172&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8322512 Stats: 16 lines in 2 files changed: 15 ins; 0 del; 1 mod Patch: https://git.openjdk.org/jdk/pull/17172.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/17172/head:pull/17172 PR: https://git.openjdk.org/jdk/pull/17172