RFR: 8257511: JDK-8254082 brings regression to AbstractStringBuilder.insert(int dstOffset, CharSequence s, int start, int end)
Alan Bateman
alanb at openjdk.java.net
Tue Dec 1 16:08:56 UTC 2020
On Tue, 1 Dec 2020 14:49:01 GMT, Claes Redestad <redestad at openjdk.org> wrote:
> This patch fixes a place where we failed to adjust properly for getBytes taking a length rather than end offset. (Something the public API in AbstractStringBuilder is apparently inconsistent about..)
>
> Although this was caught by JCK testing, this patch adds a few trivial sanity tests to get at least some sanity checking into tier1
Marked as reviewed by alanb (Reviewer).
test/jdk/java/lang/StringBuilder/Insert.java line 45:
> 43: public void insertOffset() {
> 44: // 8254082 made the String variant cause an AIOOBE, fixed in 8257511
> 45: assertEquals("efabc", new StringBuilder("abc").insert(0, "def", 1, 3).toString());
The change looks okay.
Changing this test, and converting to TestNG is okay too. I guess I wouldn't try to align the start, end on L45 as it doesn't really help readability (doesn't matter of course).
-------------
PR: https://git.openjdk.java.net/jdk/pull/1541
More information about the core-libs-dev
mailing list