On Fri, 21 Nov 2025 12:55:13 GMT, Jorn Vernee <[email protected]> wrote:
>> I added more tests to cover regular and exception cases for the three new >> methods. I'm happy to take suggestions on additional test coverage, or if >> there's a better location for any of the tests. > > Thanks, these look great! > > I think another test that tests the case where `srcIndex + numChars` > overflows for `copy` and `allocateFrom`, with different char sets (one that > takes the internal `bytesCompatible == true`, and one that takes the > `bytesCompatible == false` route) would be good to have. Thanks, I added coverage of `srcIndex + numChars` overflow for both `bytesCompatible` cases. I think that in practice some of the cases were being caught later. I added ` Objects.checkFromIndexSize` assertions to `MemorySegment#copy` and `allocateFrom` to catch them immediately with a useful exception, instead of e.g. catching it in `String.substring`. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/28043#discussion_r2549824444
