RFR: 8299982: (bf) Buffer.checkIndex(int, int) should use Objects.checkIndex(int, int)

Brian Burkhalter bpb at openjdk.org
Wed Jan 25 16:52:54 UTC 2023


On Wed, 25 Jan 2023 08:55:58 GMT, Sergey Tsypanov <stsypanov at openjdk.org> wrote:

> Why does it make such a significant difference? Intrinsic?

Yes.

`Objects::checkIndex`:

    @ForceInline
    public static
    int checkIndex(int index, int length) {
        return Preconditions.checkIndex(index, length, null);
    }

`Preconditions.checkIndex`:

    @IntrinsicCandidate
    public static <X extends RuntimeException>
    int checkIndex(int index, int length,
                   BiFunction<String, List<Number>, X> oobef) {...}

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

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


More information about the nio-dev mailing list