RFR: 8341670: [Text, TextFlow] Public API for Text Layout Info [v16]

Michael Strauß mstrauss at openjdk.org
Sat Mar 8 08:21:03 UTC 2025


On Wed, 5 Feb 2025 20:33:09 GMT, Andy Goryachev <angorya at openjdk.org> wrote:

>> modules/javafx.graphics/src/main/java/com/sun/javafx/text/PrismCaretInfo.java line 48:
>> 
>>> 46:     @Override
>>> 47:     public Rectangle2D getSegmentAt(int index) {
>>> 48:         return parts[index];
>> 
>> do we need a bound check here?
>
> no special handling is needed here I think: an exception will be thrown

While true, I think we should throw `IndexOutOfBoundsException` rather than `ArrayIndexOutOfBoundsException` (use `Objects.checkIndex()` for that). This should also be specified with a `@throws` javadoc tag in `CaretInfo`.

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

PR Review Comment: https://git.openjdk.org/jfx/pull/1596#discussion_r1986027817


More information about the openjfx-dev mailing list