Skip to content

Commit f6021a9

Browse files
author
Daniel Gredler
committed
8344668: Unnecessary array allocations and copying in TextLine
Reviewed-by: honkar, azvegint, prr
1 parent 874d68a commit f6021a9

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/java.desktop/share/classes/java/awt/font/TextLine.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -1021,7 +1021,7 @@ public static TextLineComponent[] createComponentsOnRun(int runStart,
10211021
factory.createExtended(font, cm, decorator, startPos, startPos + lmCount);
10221022

10231023
++numComponents;
1024-
if (numComponents >= components.length) {
1024+
if (numComponents > components.length) {
10251025
components = expandArray(components);
10261026
}
10271027

@@ -1076,7 +1076,7 @@ public static TextLineComponent[] getComponents(StyledParagraph styledParagraph,
10761076
pos = chunkLimit;
10771077

10781078
++numComponents;
1079-
if (numComponents >= tempComponents.length) {
1079+
if (numComponents > tempComponents.length) {
10801080
tempComponents = expandArray(tempComponents);
10811081
}
10821082

0 commit comments

Comments
 (0)