RFR: 6333341: [BI] Doc: java.text.BreakIterator class specification is unclear

Justin Lu jlu at openjdk.org
Thu Aug 24 21:48:24 UTC 2023


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("")).

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

Commit messages:
 - Use setText() instead
 - Clarify wording
 - Init

Changes: https://git.openjdk.org/jdk/pull/15422/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=15422&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-6333341
  Stats: 4 lines in 1 file changed: 4 ins; 0 del; 0 mod
  Patch: https://git.openjdk.org/jdk/pull/15422.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/15422/head:pull/15422

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


More information about the core-libs-dev mailing list