RFR: 8302590: Add String.indexOf(int ch, int fromIndex, int toIndex) [v2]

Alan Bateman alanb at openjdk.org
Mon Feb 27 15:08:05 UTC 2023


On Mon, 27 Feb 2023 13:38:59 GMT, Raffaello Giulietti <rgiulietti at openjdk.org> wrote:

>> Parking this PR while exploration is done into other options is okay.
>
> @AlanBateman Both from an `@apiNote` and from an implementation perspective, the checked _some-prefix_`IndexOf()`variants would better make use of the public 3 params `indexOf()` API point proposed here, rather than relying on `StringLatin1` and `StringUTF16` internals.
> 
> Thus, parking this PR would mean that the other PR could not refer to the API point from here until this one is integrated. 
> 
> Perhaps I'm missing something.
> Is it perhaps better to add the checked variants directly in this PR?

The suggestion is to write down some alternatives to the 3-arg indexOf method and work through some examples to see if they are less error prone. It might be that you decide to move forward with the current proposal or it might be that you decide a different method would help avoid some common mistakes.

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

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


More information about the core-libs-dev mailing list