RFR: 8303648: Add String.indexOf(String str, int beginIndex, int endIndex) [v2]

Raffaello Giulietti rgiulietti at openjdk.org
Fri Mar 10 13:54:15 UTC 2023


On Fri, 10 Mar 2023 12:52:21 GMT, Alan Bateman <alanb at openjdk.org> wrote:

>> Raffaello Giulietti has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   8303648: Add String.indexOf(String str, int beginIndex, int endIndex)
>>   
>>   Moved @apiNote on indexOf(String,int) before @param/@return.
>>   Rephrased first sentence of indexOf(String,int,int).
>
> src/java.base/share/classes/java/lang/String.java line 2626:
> 
>> 2624:      * On {@link String}s {@code s} and a non-empty {@code str}, for example,
>> 2625:      * {@code s.indexOf(str, fromIndex, s.length())} would throw if
>> 2626:      * {@code fromIndex} were larger than the string length, or were negative.
> 
> In passing, I think it's more common to put the apiNote after the method description and before the param/return.

Done in new commit

> src/java.base/share/classes/java/lang/String.java line 2634:
> 
>> 2632:     /**
>> 2633:      * Returns the smallest index of an occurrence of the specified substring
>> 2634:      * within the specified index range of {@code this} string.
> 
> It might be a bit more consistent with other methods to say "the index of the first occurrence". That will make it consistent with the proposed @return text too. Otherwise the proposed wording looks okay to me.

Done in new commit

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

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


More information about the core-libs-dev mailing list