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

Alan Bateman alanb at openjdk.org
Wed Jan 25 18:11:45 UTC 2023


On Wed, 25 Jan 2023 17:56:31 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:

> Presently there is no exception message so no one can be relying on it.

I should have been cleaner, I mean the message is confusing. In the example the message includes "for length -1" but that doesn't make any sense here. I suspect we'll need to add a new exception mapper to Preconditions and have checkIndex call the 3-arg Preconditions.checkIndex method. In Buffer, the checkIndex can be @ForceInline so it inlines similar to Objects.checkIndex.

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

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


More information about the nio-dev mailing list