Skip to content

Commit

Permalink
8344668: Unnecessary array allocations and copying in TextLine
Browse files Browse the repository at this point in the history
Reviewed-by: honkar, azvegint, prr
  • Loading branch information
Daniel Gredler committed Dec 6, 2024
1 parent 874d68a commit f6021a9
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/java.desktop/share/classes/java/awt/font/TextLine.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -1021,7 +1021,7 @@ public static TextLineComponent[] createComponentsOnRun(int runStart,
factory.createExtended(font, cm, decorator, startPos, startPos + lmCount);

++numComponents;
if (numComponents >= components.length) {
if (numComponents > components.length) {
components = expandArray(components);
}

Expand Down Expand Up @@ -1076,7 +1076,7 @@ public static TextLineComponent[] getComponents(StyledParagraph styledParagraph,
pos = chunkLimit;

++numComponents;
if (numComponents >= tempComponents.length) {
if (numComponents > tempComponents.length) {
tempComponents = expandArray(tempComponents);
}

Expand Down

1 comment on commit f6021a9

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.