8255150: Add utility methods to check long indexes and ranges #1003
This change add 3 new methods in Objects:
public static long checkIndex(long index, long length)
This mirrors the int utility methods that were added by JDK-8135248
As is the case with the int checkIndex(), the long checkIndex() method
This change includes:
This is a joint work with Paul who reviewed and reworked the API change
JornVernee left a comment
Hi Roland, Paul. Thank you for tackling this! We have to jump through quite a few hoops in the implementation of the foreign memory access API in order to leverage the intrinsification of int-based index checks, and even then we are not covering the cases where the numbers are larger than ints. Looking forward to being able to remove those hacks!
Although I'm not a 'Reviewer', I've done a pass over the code and left some inline comments that I hope you find useful.
@rwestrel This change now passes all automated pre-integration checks.
After integration, the commit message for the final commit will be:
At the time when this comment was updated there had been 2 new commits pushed to the
Please see this link for an up-to-date comparison between the source branch of this pull request and the
@rwestrel this pull request can not be integrated into
git checkout JDK-8255150 git fetch https://git.openjdk.java.net/jdk master git merge FETCH_HEAD # resolve conflicts and follow the instructions given by git merge git commit -m "Merge master" git push
@rwestrel Since your change was applied there have been 2 commits pushed to the
Your commit was automatically rebased without conflicts.
Pushed as commit a7422ac.
Co-authored-by: Paul Sandoz <firstname.lastname@example.org> Reviewed-by: jvernee, dlong, vlivanov