RFR: 8346657: Improve out of bounds exception messages for MemorySegments [v10]
Jorn Vernee
jvernee at openjdk.org
Mon Nov 24 18:21:07 UTC 2025
On Fri, 21 Nov 2025 17:26:59 GMT, Igor Rudenko <duke at openjdk.org> wrote:
>> Logic for creating IndexOutOfBoundsException in MemorySegment is reworked:
>> - separate logic of checking bounds and constructing exception messages for both `access` and `slice` cases
>> - idea presented in [JDK-8288534](https://bugs.openjdk.org/browse/JDK-8288534) slightly reworked with preservation of the original approach
>
> Igor Rudenko has updated the pull request incrementally with one additional commit since the last revision:
>
> implement re-throwing approach according to reviewer recomandation
Thanks for the changes, that looks like what I had in mind. I like how this patch splits the uses of the access check into plain access and slice as well.
WRT catching and re-throwing: I don't think performance matters here, since an OOB access is likely to be on the slow path any way.
-------------
Marked as reviewed by jvernee (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/28124#pullrequestreview-3501663540
More information about the core-libs-dev
mailing list