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

Michael Strauß mstrauss at openjdk.org
Mon Apr 7 19:17:22 UTC 2025


On Mon, 7 Apr 2025 18:39:25 GMT, Andy Goryachev <angorya at openjdk.org> wrote:

>> modules/javafx.graphics/src/main/java/javafx/scene/text/CaretInfo.java line 62:
>> 
>>> 60:      *     {@code (index < 0 || index > getSegmentCount())}
>>> 61:      */
>>> 62:     public abstract Rectangle2D getSegmentAt(int index);
>> 
>> The naming style in `CaretInfo`, `LayoutInfo`, and `TextLineInfo` is a bit inconsistent in that it uses both `getFoo()` as well as `foo()` (both with and without method arguments). I think you should decide on one way or the other.
>
> `TextLineInfo` is a record, I don't want to add duplicate getXXX() aliases there.
> 
> The other (in `LayoutInfo`) are modeled after `Text`/`TextFlow` (e.g. `underlineShape()`), I have no problem with any of these.  I don't think we have strict rules regarding naming, and these are not java beans to utilize some sort of naming pattern in accessors, but I could be missing something.
> 
> Could you be more specific?

I understand the argument for `TextLineInfo`, I guess I'm looking more at `LayoutInfo` here. My question is whether it is really the best choice to sacrifice local consistency within a single class just to have it look more similar to equally inconsistently named methods in another class? Anyway, I just wanted to point this out, that's not a hill for me to die on.

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

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


More information about the openjfx-dev mailing list