JDK-4138921: TextLayout handling of empty strings

Daniel Gredler djgredler at gmail.com
Mon Aug 11 16:20:29 UTC 2025


Hi all,

I was thinking of taking a stab at JDK-4138921 [1], and I have a couple of
questions.

First, there is a related API oddity in that null FontRenderContext
parameters passed to the TextLayout constructors cause a
NullPointerException, rather than an IllegalArgumentException (like all
other parameters). Can this behavior also be changed?

Second, changing all three TextLayout constructors to accept empty strings
sort of implies that we should also allow empty strings in AttributedString
instances (this is currently only allowed if the attribute map is empty).
Is it OK to change this behavior as well?

Let me know your thoughts!

Daniel

[1] https://bugs.openjdk.org/browse/JDK-4138921
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/client-libs-dev/attachments/20250811/2485cc69/attachment.htm>


More information about the client-libs-dev mailing list