RFR: 6333341: [BI] Doc: java.text.BreakIterator class specification is unclear
Naoto Sato
naoto at openjdk.org
Tue Aug 29 18:43:07 UTC 2023
On Thu, 24 Aug 2023 21:39:39 GMT, Justin Lu <jlu at openjdk.org> wrote:
> Please review this PR and [CSR ](https://bugs.openjdk.org/browse/JDK-8314974)which clarifies behavior for BreakIterator instances when text has not been set.
>
> For example, calling `BreakIterator.getWordInstance().next();` has an ambiguous result.
> A boundary searching operation was called but no text was supplied. Is the result an exception, 0, -1 (BreakIterator.DONE), or something else? In reality, the operation will be performed on any empty string.
>
>
> This change makes it apparent that failing to set the text will cause the BreakIterator instance to default to a `StringCharacterIterator` with an empty string (equivalent to calling setText("")).
src/java.base/share/classes/java/text/BreakIterator.java line 112:
> 110: * of calling {@code setText("")} if the text hasn't been set by either
> 111: * {@link #setText(String)} or {@link #setText(CharacterIterator)}
> 112: * and a boundary searching operation is called by the {@code BreakIterator} instance.
`@implNote` would be desired here
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/15422#discussion_r1309215800
More information about the core-libs-dev
mailing list