RFR: 8368775: Remove outdated comment in OutlineTextRenderer

Phil Race prr at openjdk.org
Fri Sep 26 18:58:16 UTC 2025


On Fri, 26 Sep 2025 16:24:23 GMT, Daniel Gredler <dgredler at openjdk.org> wrote:

> > You can use str.isEmpty() here.
> 
> I was actually going for consistency with all of the other optimizations of this type, which all use a length check. I can change it to `isEmpty` if you feel strongly about it, though.

I think a lot of cases were written before isEmpty() existed so would have used length().
isEmpty() might perform a 'tiny' bit better. But that's all.

> 
> > Do we actually call this method with an empty string?
> 
> I do think it's possible, e.g. from `SunGraphics2D.drawString(String, int, int)` and `SunGraphics2D.drawString(String, float, float)` when the font doesn't have layout attributes, or a few other places when `OutlineTextRenderer.drawChars(...)` delegates to `OutlineTextRenderer.drawString(...)`.

I agree.
Even if we added some checks there, it would require work to prove that there's no way to get here with an empty string.
I see no harm in the check here, especially if we aren't 100% confident.

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

PR Comment: https://git.openjdk.org/jdk/pull/27523#issuecomment-3340051462


More information about the client-libs-dev mailing list