RFR: 8268698: Use Objects.check{Index, FromToIndex, FromIndexSize} where possible [v6]
Paul Sandoz
psandoz at openjdk.java.net
Mon Jun 21 21:02:30 UTC 2021
On Mon, 21 Jun 2021 05:17:09 GMT, Yi Yang <yyang at openjdk.org> wrote:
>> After JDK-8265518(#3615), it's possible to replace all variants of checkIndex by Objects.checkIndex/Objects.checkFromToIndex/Objects.checkFromIndexSize in the whole JDK codebase.
>
> Yi Yang has updated the pull request incrementally with one additional commit since the last revision:
>
> more replacement 2
All the updates to the check* methods look ok (requires some careful looking!).
I cannot recall what others said about the change in exception messages. @jddarcy any advice here?
src/java.base/share/classes/jdk/internal/util/Preconditions.java line 78:
> 76: = Preconditions.outOfBoundsExceptionFormatter(new StringIndexOutOfBoundsExceptionProducer());
> 77:
> 78: public static final BiFunction<String, List<Number>, StringIndexOutOfBoundsException> AIOOBE_FORMATTER
Using incorrect exception type. Suggest you embed as inner class rather than separate declaration, since they are only used in one place.
-------------
PR: https://git.openjdk.java.net/jdk/pull/4507
More information about the security-dev
mailing list