RFR: 8341670: [Text, TextFlow] Public API for Text Layout Info [v23]
Michael Strauß
mstrauss at openjdk.org
Mon Apr 7 18:56:21 UTC 2025
On Mon, 7 Apr 2025 18:30:47 GMT, Andy Goryachev <angorya at openjdk.org> wrote:
> > Can this class be sealed?
>
> Theoretically, yes, but what problem would that solve?
>
> I can understand when sealing would make the platform more secure, but in this case I see no value whatsoever. Could you give me an example where sealing the `LayoutInfo` class might help?
I think a class should always be final or sealed by default, no further justification required (it's one of the defaults the Java language arguably got wrong). Justification should be given for a class to be extensible, as that will invariably add to the incompatibility budget required for future changes. Designing a class for extensibility is also usually very different from designing a sealed class, and there are many examples in JavaFX where careless extensibility leads to problems down the line.
> edit: I can see the value of sealing in some security context, but I really dislike how this exposes the internals via `permits`.
How so? You can't do anything with non-exported permitted subclasses, so it's not leaking anything in that sense. Javadoc also doesn't show you non-exported permitted classes.
-------------
PR Comment: https://git.openjdk.org/jfx/pull/1596#issuecomment-2784268100
More information about the openjfx-dev
mailing list