8273375: Remove redundant 'new String' calls after concatenation in java.desktop

Reviewed-by: aivanov
This commit is contained in:
Andrey Turbanov 2021-09-08 14:28:07 +00:00 committed by Alexey Ivanov
parent faa942c8ba
commit 59c9f75041
15 changed files with 93 additions and 83 deletions

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2011, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -3206,7 +3206,10 @@ public class AquaTabbedPaneCopyFromBasicUI extends TabbedPaneUI implements Swing
} }
public String toString() { public String toString() {
return new String("viewport.viewSize=" + viewport.getViewSize() + "\n" + "viewport.viewRectangle=" + viewport.getViewRect() + "\n" + "leadingTabIndex=" + leadingTabIndex + "\n" + "tabViewPosition=" + tabViewPosition); return "viewport.viewSize=" + viewport.getViewSize() + "\n"
+ "viewport.viewRectangle=" + viewport.getViewRect() + "\n"
+ "leadingTabIndex=" + leadingTabIndex + "\n"
+ "tabViewPosition=" + tabViewPosition;
} }
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2011, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -87,10 +87,10 @@ public class IntegerNIORaster extends SunWritableRaster {
} }
public String toString() { public String toString() {
return new String ("IntegerNIORaster: width = "+width return "IntegerNIORaster: width = " + width
+ " height = " + height + " height = " + height
+ " #Bands = " + numBands + " #Bands = " + numBands
+ " xOff = " + sampleModelTranslateX + " xOff = " + sampleModelTranslateX
+" yOff = "+sampleModelTranslateY); + " yOff = " + sampleModelTranslateY;
} }
} }

View File

@ -1673,13 +1673,12 @@ public abstract class ColorModel implements Transparency{
* {@code ColorModel} object. * {@code ColorModel} object.
*/ */
public String toString() { public String toString() {
return new String("ColorModel: #pixelBits = "+pixel_bits return "ColorModel: #pixelBits = " + pixel_bits
+ " numComponents = " + numComponents + " numComponents = " + numComponents
+ " color space = " + colorSpace + " color space = " + colorSpace
+ " transparency = " + transparency + " transparency = " + transparency
+ " has alpha = " + supportsAlpha + " has alpha = " + supportsAlpha
+ " isAlphaPre = "+isAlphaPremultiplied + " isAlphaPre = " + isAlphaPremultiplied;
);
} }
static int getDefaultTransferType(int pixel_bits) { static int getDefaultTransferType(int pixel_bits) {

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1995, 2018, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1995, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -1407,10 +1407,9 @@ public class DirectColorModel extends PackedColorModel {
* {@code DirectColorModel}. * {@code DirectColorModel}.
*/ */
public String toString() { public String toString() {
return new String("DirectColorModel: rmask=" return "DirectColorModel: rmask=" + Integer.toHexString(red_mask)
+Integer.toHexString(red_mask)+" gmask=" + " gmask=" + Integer.toHexString(green_mask)
+Integer.toHexString(green_mask)+" bmask=" + " bmask=" + Integer.toHexString(blue_mask)
+Integer.toHexString(blue_mask)+" amask=" + " amask=" + Integer.toHexString(alpha_mask);
+Integer.toHexString(alpha_mask));
} }
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1995, 2020, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1995, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -1536,14 +1536,13 @@ public class IndexColorModel extends ColorModel {
* {@code ColorModel} object. * {@code ColorModel} object.
*/ */
public String toString() { public String toString() {
return new String("IndexColorModel: #pixelBits = "+pixel_bits return "IndexColorModel: #pixelBits = " + pixel_bits
+ " numComponents = " + numComponents + " numComponents = " + numComponents
+ " color space = " + colorSpace + " color space = " + colorSpace
+ " transparency = " + transparency + " transparency = " + transparency
+ " transIndex = " + transparent_index + " transIndex = " + transparent_index
+ " has alpha = " + supportsAlpha + " has alpha = " + supportsAlpha
+ " isAlphaPre = "+isAlphaPremultiplied + " isAlphaPre = " + isAlphaPremultiplied;
);
} }
/** /**

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -24,6 +24,7 @@
*/ */
package sun.awt.image; package sun.awt.image;
import java.awt.image.Raster; import java.awt.image.Raster;
import java.awt.image.WritableRaster; import java.awt.image.WritableRaster;
import java.awt.image.RasterFormatException; import java.awt.image.RasterFormatException;
@ -818,10 +819,11 @@ public class ByteBandedRaster extends SunWritableRaster {
} }
public String toString() { public String toString() {
return new String ("ByteBandedRaster: width = "+width+" height = " return "ByteBandedRaster: width = " + width
+ height + " height = " + height
+ " #bands " + numDataElements + " #bands " + numDataElements
+" minX = "+minX+" minY = "+minY); + " minX = " + minX
+ " minY = " + minY;
} }
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -24,6 +24,7 @@
*/ */
package sun.awt.image; package sun.awt.image;
import java.awt.image.Raster; import java.awt.image.Raster;
import java.awt.image.WritableRaster; import java.awt.image.WritableRaster;
import java.awt.image.RasterFormatException; import java.awt.image.RasterFormatException;
@ -945,11 +946,11 @@ public class ByteComponentRaster extends SunWritableRaster {
} }
public String toString() { public String toString() {
return new String ("ByteComponentRaster: width = "+width+" height = " return "ByteComponentRaster: width = " + width
+ height + " height = " + height
+ " #numDataElements " + numDataElements + " #numDataElements " + numDataElements
// +" xOff = "+xOffset+" yOff = "+yOffset // +" xOff = "+xOffset+" yOff = "+yOffset
+" dataOff[0] = "+dataOffsets[0]); + " dataOff[0] = " + dataOffsets[0];
} }
// /** // /**

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1998, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -24,6 +24,7 @@
*/ */
package sun.awt.image; package sun.awt.image;
import java.awt.image.Raster; import java.awt.image.Raster;
import java.awt.image.WritableRaster; import java.awt.image.WritableRaster;
import java.awt.image.RasterFormatException; import java.awt.image.RasterFormatException;
@ -1288,11 +1289,11 @@ public class ByteInterleavedRaster extends ByteComponentRaster {
} }
public String toString() { public String toString() {
return new String ("ByteInterleavedRaster: width = "+width+" height = " return "ByteInterleavedRaster: width = " + width
+ height + " height = " + height
+ " #numDataElements " + numDataElements + " #numDataElements " + numDataElements
// +" xOff = "+xOffset+" yOff = "+yOffset // +" xOff = "+xOffset+" yOff = "+yOffset
+" dataOff[0] = "+dataOffsets[0]); + " dataOff[0] = " + dataOffsets[0];
} }
// /** // /**

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -1425,9 +1425,10 @@ public class BytePackedRaster extends SunWritableRaster {
} }
public String toString() { public String toString() {
return new String ("BytePackedRaster: width = "+width+" height = "+height return "BytePackedRaster: width = " + width
+ " height = " + height
+ " #channels " + numBands + " #channels " + numBands
+ " xOff = " + sampleModelTranslateX + " xOff = " + sampleModelTranslateX
+" yOff = "+sampleModelTranslateY); + " yOff = " + sampleModelTranslateY;
} }
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -24,6 +24,7 @@
*/ */
package sun.awt.image; package sun.awt.image;
import java.awt.image.Raster; import java.awt.image.Raster;
import java.awt.image.WritableRaster; import java.awt.image.WritableRaster;
import java.awt.image.RasterFormatException; import java.awt.image.RasterFormatException;
@ -714,13 +715,13 @@ public class IntegerComponentRaster extends SunWritableRaster {
} }
public String toString() { public String toString() {
return new String ("IntegerComponentRaster: width = "+width return "IntegerComponentRaster: width = " + width
+ " height = " + height + " height = " + height
+ " #Bands = " + numBands + " #Bands = " + numBands
+ " #DataElements " + numDataElements + " #DataElements " + numDataElements
+ " xOff = " + sampleModelTranslateX + " xOff = " + sampleModelTranslateX
+ " yOff = " + sampleModelTranslateY + " yOff = " + sampleModelTranslateY
+" dataOffset[0] "+dataOffsets[0]); + " dataOffset[0] " + dataOffsets[0];
} }
// /** // /**

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1998, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -24,6 +24,7 @@
*/ */
package sun.awt.image; package sun.awt.image;
import java.awt.image.Raster; import java.awt.image.Raster;
import java.awt.image.WritableRaster; import java.awt.image.WritableRaster;
import java.awt.image.RasterFormatException; import java.awt.image.RasterFormatException;
@ -537,12 +538,12 @@ public class IntegerInterleavedRaster extends IntegerComponentRaster {
} }
public String toString() { public String toString() {
return new String ("IntegerInterleavedRaster: width = "+width return "IntegerInterleavedRaster: width = " + width
+ " height = " + height + " height = " + height
+ " #Bands = " + numBands + " #Bands = " + numBands
+ " xOff = " + sampleModelTranslateX + " xOff = " + sampleModelTranslateX
+ " yOff = " + sampleModelTranslateY + " yOff = " + sampleModelTranslateY
+" dataOffset[0] "+dataOffsets[0]); + " dataOffset[0] " + dataOffsets[0];
} }
// /** // /**

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -24,6 +24,7 @@
*/ */
package sun.awt.image; package sun.awt.image;
import java.awt.image.Raster; import java.awt.image.Raster;
import java.awt.image.WritableRaster; import java.awt.image.WritableRaster;
import java.awt.image.RasterFormatException; import java.awt.image.RasterFormatException;
@ -802,10 +803,10 @@ public class ShortBandedRaster extends SunWritableRaster {
} }
public String toString() { public String toString() {
return new String ("ShortBandedRaster: width = "+width+" height = " return "ShortBandedRaster: width = " + width
+ height + " height = " + height
+ " #numBands " + numBands + " #numBands " + numBands
+" #dataElements "+numDataElements); + " #dataElements " + numDataElements;
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -24,6 +24,7 @@
*/ */
package sun.awt.image; package sun.awt.image;
import java.awt.image.Raster; import java.awt.image.Raster;
import java.awt.image.WritableRaster; import java.awt.image.WritableRaster;
import java.awt.image.RasterFormatException; import java.awt.image.RasterFormatException;
@ -877,9 +878,9 @@ public class ShortComponentRaster extends SunWritableRaster {
} }
public String toString() { public String toString() {
return new String ("ShortComponentRaster: width = "+width return "ShortComponentRaster: width = " + width
+ " height = " + height + " height = " + height
+" #numDataElements "+numDataElements); + " #numDataElements " + numDataElements;
// +" xOff = "+xOffset+" yOff = "+yOffset); // +" xOff = "+xOffset+" yOff = "+yOffset);
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1998, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -24,6 +24,7 @@
*/ */
package sun.awt.image; package sun.awt.image;
import java.awt.image.Raster; import java.awt.image.Raster;
import java.awt.image.WritableRaster; import java.awt.image.WritableRaster;
import java.awt.image.RasterFormatException; import java.awt.image.RasterFormatException;
@ -758,9 +759,9 @@ public class ShortInterleavedRaster extends ShortComponentRaster {
} }
public String toString() { public String toString() {
return new String ("ShortInterleavedRaster: width = "+width return "ShortInterleavedRaster: width = " + width
+ " height = " + height + " height = " + height
+" #numDataElements "+numDataElements); + " #numDataElements " + numDataElements;
// +" xOff = "+xOffset+" yOff = "+yOffset); // +" xOff = "+xOffset+" yOff = "+yOffset);
} }

View File

@ -389,7 +389,7 @@ public abstract class InfoWindow extends Window {
if (nLines == BALLOON_WORD_LINE_MAX_COUNT) { if (nLines == BALLOON_WORD_LINE_MAX_COUNT) {
if (end != BreakIterator.DONE) { if (end != BreakIterator.DONE) {
lineLabels[nLines - 1].setText( lineLabels[nLines - 1].setText(
new String(lineLabels[nLines - 1].getText() + " ...")); lineLabels[nLines - 1].getText() + " ...");
} }
break; break;
} }