RFR: 8341670: [Text, TextFlow] Public API for Text Layout Info [v18]
Michael Strauß
mstrauss at openjdk.org
Thu May 22 15:40:11 UTC 2025
On Thu, 22 May 2025 15:16:57 GMT, Andy Goryachev <angorya at openjdk.org> wrote:
>> The point is that it's less complicated to have self-describing, strongly typed, and compiler-checked code. Your code is more complicated because it's brittle, untyped, and less robust against refactoring.
>>
>> Just to make sure that we're on the same page here: "so it was made as low level as possible" sounds like you deliberately chose to forgo strong typing... to achieve _what_?
>
> There are exactly two internal consumers of that internal API (`PrismLayoutInfo` and `TextUtils.getCaretShape`), and the return value is documented. I don't want to add any more internal classes, just to repackage the thing into what is eventually delivered via public API, and I cannot use the public API data objects because they are different in the two different use cases.
>
> I don't think it's worth to add a bunch of classes at this level, float[] works just fine.
>
> Is this something you consider to be so important to be an integration blocker?
Discriminated unions are an amazing tool in the type system if you want to return a number of differently shaped things, which is exactly what you're doing here. You make it sound like giving names to things is somehow a downside, when it's the exact opposite (classes/records are not a finite resource, it's what we use to name things).
I do consider readibility and maintainability to be important, yes. A float array is none of that.
-------------
PR Review Comment: https://git.openjdk.org/jfx/pull/1596#discussion_r2102862116
More information about the openjfx-dev
mailing list