RFR: 8299982: (bf) Buffer.checkIndex(int, int) should use Objects.checkIndex(int, int) [v2]
Brian Burkhalter
bpb at openjdk.org
Wed Jan 25 20:34:00 UTC 2023
On Wed, 25 Jan 2023 20:22:19 GMT, Alan Bateman <alanb at openjdk.org> wrote:
>> Brian Burkhalter has updated the pull request incrementally with one additional commit since the last revision:
>>
>> 8299982: Change Objects::checkIndex to Preconditions::checkIndex; improve exception message
>
> src/java.base/share/classes/java/nio/Buffer.java line 752:
>
>> 750: final int checkIndex(int i, int nb) { // package-private
>> 751: return Preconditions.checkIndex(i, limit - nb + 1,
>> 752: (x, y) -> {
>
> I don't know if you've retested the performance but I think you'll need this parameter to be a constant and checkIndex may need to be ForceInline. While we're here, I think we'll have to check the exception message throw by the 1-arg checkIndex to make sure it make sense for buffers.
I re-tested with and without ForceInline and see little difference.
-------------
PR: https://git.openjdk.org/jdk/pull/12174
More information about the nio-dev
mailing list