RFR: 8299982: (bf) Buffer.checkIndex(int, int) should use Preconditions.checkIndex(int, int, BiFunction) [v2]

Uwe Schindler uschindler at openjdk.org
Thu Jan 26 09:49:52 UTC 2023


On Thu, 26 Jan 2023 07:18:02 GMT, Alan Bateman <alanb at openjdk.org> wrote:

>> I re-tested with and without ForceInline and see little difference.
>
> I was hoping the  3rd parameter to Preconditions.checkIndex would be constant. It looks like it's a capturing lambda ("this" is captured because of the access to the position/limit fields). Hmm, maybe start out simple with a constant, otherwise this change is going to require much wider startup and performance testing.

In the original code it just has `throw new IndexOutOfBoundsException();`, so why not make it non-capturing lambda by just returning the same, e.g., `(x, y) -> new IndexOutOfBoundsException()`

-------------

PR: https://git.openjdk.org/jdk/pull/12174


More information about the nio-dev mailing list