On Fri, 26 Sep 2025 11:23:03 GMT, Daniel Gredler <[email protected]> wrote:
> Until [JDK-4138921](https://bugs.openjdk.org/browse/JDK-4138921), > `TextLayout` did not accept empty strings in the constructor. This limitation > has been removed. However, there is a guard condition in > `OutlineTextRenderer` which checks for an empty string before trying to use > `TextLayout` which explicitly calls out this limitation in a code comment. We > should remove the out-of-date comment but leave the check in as an > optimization (see discussion in PR #26947). src/java.desktop/share/classes/sun/java2d/pipe/OutlineTextRenderer.java line 76: > 74: public void drawString(SunGraphics2D g2d, String str, double x, > double y) { > 75: > 76: if (str.length() == 0) { You can use str.isEmpty() here. Do we actually call this method with an empty string? I think we have such an optimization at a higher level in SunGraphics2D. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/27523#discussion_r2382848523
