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

2023-02-28 Thread Raffaello Giulietti
On Fri, 24 Feb 2023 17:45:23 GMT, Raffaello Giulietti wrote: >> Add an `indexOf()` variant allowing to specify both a lower and an upper >> bound on the search. > > Raffaello Giulietti has updated the pull request incrementally with one > additional commit since the last revision: > > 83025

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

2023-02-27 Thread Raffaello Giulietti
On Mon, 27 Feb 2023 15:05:05 GMT, Alan Bateman wrote: >> @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 >> `

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

2023-02-27 Thread Alan Bateman
On Mon, 27 Feb 2023 13:38:59 GMT, Raffaello Giulietti 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 > p

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

2023-02-27 Thread Raffaello Giulietti
On Mon, 27 Feb 2023 12:40:34 GMT, Alan Bateman wrote: >> @AlanBateman I can propose variants of forward-searching >> _some-prefix_`IndexOf()` which are consistent with `substring()` in their >> handling of the indices, but I'd then rather prefer to file another JBS >> issue and prepare another

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

2023-02-27 Thread Alan Bateman
On Mon, 27 Feb 2023 12:25:54 GMT, Raffaello Giulietti wrote: >> Consistency with the indexOf/lastIndexOf methods is good, it makes it look >> like the method has been there since JDK 1.0. At the same time, it could >> mean that bugs go undetected, e.g. it would be easy to assume the range is

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

2023-02-27 Thread Raffaello Giulietti
On Mon, 27 Feb 2023 11:02:34 GMT, Alan Bateman wrote: >> @viktorklang-ora I agree that the behavior w.r.t. out-of-range indices is at >> odd with the `substring()` family, but this inconsistency is already present >> since the dawn of time ;-) > > Consistency with the indexOf/lastIndexOf method

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

2023-02-27 Thread Alan Bateman
On Mon, 27 Feb 2023 09:37:57 GMT, Raffaello Giulietti wrote: >> @rgiulietti That's surprising, but if it is as you say, then the indexOf >> with or without the endIndex should behave identically and not throw. > > @viktorklang-ora I agree that the behavior w.r.t. out-of-range indices is at > o

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

2023-02-27 Thread Raffaello Giulietti
On Mon, 27 Feb 2023 08:00:32 GMT, Viktor Klang wrote: >> (I guess you are referring to the fact that `substring()` can throw.) > > @rgiulietti That's surprising, but if it is as you say, then the indexOf with > or without the endIndex should behave identically and not throw. @viktorklang-ora I

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

2023-02-27 Thread Viktor Klang
On Fri, 24 Feb 2023 16:37:58 GMT, Raffaello Giulietti wrote: >> Then you would also expect `string.substring(fromIndex).indexOf(ch)` to >> behave isomorphically to `string.indexOf(ch, fromIndex)` in current >> releases, right? >> It does not. > > (I guess you are referring to the fact that `su

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

2023-02-24 Thread Roger Riggs
On Fri, 24 Feb 2023 17:45:42 GMT, Raffaello Giulietti wrote: >> addressed > > JMH does not indicate any performance regression. > > W.r.t. renaming Java parameters in `@IntrinsicCandidate` methods, I > crosschecked with a runtime compiler guy. He confirms that changing names in > the Java imp

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

2023-02-24 Thread Raffaello Giulietti
On Fri, 24 Feb 2023 17:40:52 GMT, Raffaello Giulietti wrote: >> src/java.base/share/classes/java/lang/String.java line 2462: >> >>> 2460: * >>> 2461: * There are no restrictions on the value of {@code fromIndex} >>> and >>> 2462: * {@code toIndex}. Negative values have the same

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

2023-02-24 Thread Raffaello Giulietti
On Fri, 24 Feb 2023 15:38:22 GMT, Roger Riggs wrote: >> I was reluctant to add it, as it is not yet known when the PR will be >> integrated. I'll add it in the next commit. > > When the CSR is approved is a good trigger for adding @since. But its fine > to be optimistic in the PR. addressed

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

2023-02-24 Thread Raffaello Giulietti
> Add an `indexOf()` variant allowing to specify both a lower and an upper > bound on the search. Raffaello Giulietti has updated the pull request incrementally with one additional commit since the last revision: 8302590: Add String.indexOf(int ch, int fromIndex, int toIndex) -

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

2023-02-24 Thread Raffaello Giulietti
On Thu, 23 Feb 2023 17:04:17 GMT, Roger Riggs wrote: >> Raffaello Giulietti has updated the pull request incrementally with one >> additional commit since the last revision: >> >> 8302590: Add String.indexOf(int ch, int fromIndex, int toIndex) > > src/java.base/share/classes/java/lang/String.