8301828: Avoid unnecessary array fill after creation in javax.swing.text

Reviewed-by: prr, serb
This commit is contained in:
Andrey Turbanov 2023-02-08 14:29:21 +00:00
parent 3db352d003
commit 9af2ea203d
2 changed files with 2 additions and 7 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2023, 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
@ -24,7 +24,6 @@
*/
package javax.swing.text;
import java.util.Arrays;
import java.awt.*;
import java.awt.font.TextAttribute;
import java.awt.geom.Rectangle2D;
@ -1046,7 +1045,6 @@ public class ParagraphView extends FlowView implements TabExpander {
int rowStartOffset = getStartOffset();
int rowEndOffset = getEndOffset();
int[] spaceMap = new int[rowEndOffset - rowStartOffset];
Arrays.fill(spaceMap, 0);
for (int i = getViewCount() - 1; i >= 0 ; i--) {
View view = getView(i);
if (view instanceof GlyphView) {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2023, 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
@ -1013,9 +1013,6 @@ import javax.swing.text.*;
*/
private void updatePercentagesAndAdjustmentWeights(int span) {
adjustmentWeights = new int[columnRequirements.length];
for (int i = 0; i < columnRequirements.length; i++) {
adjustmentWeights[i] = 0;
}
if (relativeCells) {
percentages = new int[columnRequirements.length];
} else {