Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8274680: Remove unnecessary conversion to String in java.desktop #5799

Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 2021, 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 @@ -33,7 +33,6 @@
import java.io.IOException;
import java.util.List;
import java.util.ArrayList;
import java.util.Iterator;

import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
Expand Down Expand Up @@ -119,8 +118,7 @@ void write(ImageOutputStream ios) throws IOException {

void print() {
printTag("DHT");
System.out.println("Num tables: "
+ Integer.toString(tables.size()));
System.out.println("Num tables: " + tables.size());
for (int i= 0; i<tables.size(); i++) {
Htable table = tables.get(i);
table.print();
Expand Down Expand Up @@ -232,7 +230,7 @@ void print() {
System.out.println("Huffman Table");
System.out.println("table class: "
+ ((tableClass == 0) ? "DC":"AC"));
System.out.println("table id: " + Integer.toString(tableID));
System.out.println("table id: " + tableID);

(new JPEGHuffmanTable(numCodes, values)).toString();
/*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 2021, 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 @@ -34,7 +34,6 @@
import java.io.IOException;
import java.util.List;
import java.util.ArrayList;
import java.util.Iterator;

import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
Expand Down Expand Up @@ -112,8 +111,7 @@ void write(ImageOutputStream ios) throws IOException {

void print() {
printTag("DQT");
System.out.println("Num tables: "
+ Integer.toString(tables.size()));
System.out.println("Num tables: " + tables.size());
for (int i= 0; i<tables.size(); i++) {
Qtable table = tables.get(i);
table.print();
Expand Down Expand Up @@ -288,9 +286,8 @@ IIOMetadataNode getNativeNode() {
}

void print() {
System.out.println("Table id: " + Integer.toString(tableID));
System.out.println("Element precision: "
+ Integer.toString(elementPrecision));
System.out.println("Table id: " + tableID);
System.out.println("Element precision: " + elementPrecision);

(new JPEGQTable(data)).toString();
/*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 2021, 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 @@ -77,7 +77,6 @@ void write(ImageOutputStream ios) throws IOException {

void print() {
printTag("DRI");
System.out.println("Interval: "
+ Integer.toString(restartInterval));
System.out.println("Interval: " + restartInterval);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -617,8 +617,7 @@ void print() {
printTag("JFIF");
System.out.print("Version ");
System.out.print(majorVersion);
System.out.println(".0"
+ Integer.toString(minorVersion));
System.out.println(".0" + minorVersion);
System.out.print("Resolution units: ");
System.out.println(resUnits);
System.out.print("X density: ");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -979,14 +979,14 @@ public IIOMetadataNode getStandardDataNode() {
sbits = Integer.toString(sBIT_grayBits);
} else { // sBIT_colorType == PNGImageReader.PNG_COLOR_RGB ||
// sBIT_colorType == PNGImageReader.PNG_COLOR_RGB_ALPHA
sbits = Integer.toString(sBIT_redBits) + " " +
Integer.toString(sBIT_greenBits) + " " +
Integer.toString(sBIT_blueBits);
sbits = sBIT_redBits + " " +
sBIT_greenBits + " " +
sBIT_blueBits;
}

if (sBIT_colorType == PNGImageReader.PNG_COLOR_GRAY_ALPHA ||
sBIT_colorType == PNGImageReader.PNG_COLOR_RGB_ALPHA) {
sbits += " " + Integer.toString(sBIT_alphaBits);
sbits += " " + sBIT_alphaBits;
}

node.setAttribute("value", sbits);
Expand Down Expand Up @@ -1134,9 +1134,9 @@ public IIOMetadataNode getStandardTransparencyNode() {
node = new IIOMetadataNode("TransparentColor");
if (tRNS_colorType == PNGImageReader.PNG_COLOR_RGB) {
node.setAttribute("value",
Integer.toString(tRNS_red) + " " +
Integer.toString(tRNS_green) + " " +
Integer.toString(tRNS_blue));
tRNS_red + " " +
tRNS_green + " " +
tRNS_blue);
} else if (tRNS_colorType == PNGImageReader.PNG_COLOR_GRAY) {
node.setAttribute("value", Integer.toString(tRNS_gray));
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2021, 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 @@ -28,7 +28,6 @@
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import com.sun.imageio.plugins.tiff.TIFFFieldNode;
import com.sun.imageio.plugins.tiff.TIFFIFD;

/**
* A class representing a field in a TIFF 6.0 Image File Directory.
Expand Down Expand Up @@ -1304,14 +1303,10 @@ public String getValueAsString(int index) {
// If the denominator is a non-zero integral divisor
// of the numerator then convert the fraction to be
// with respect to a unity denominator.
srationalString =
Integer.toString(ivalue[0] / ivalue[1]) + "/1";
srationalString = (ivalue[0] / ivalue[1]) + "/1";
} else {
// Use the values directly.
srationalString =
Integer.toString(ivalue[0]) +
"/" +
Integer.toString(ivalue[1]);
srationalString = ivalue[0] + "/" + ivalue[1];
}
return srationalString;
case TIFFTag.TIFF_RATIONAL:
Expand All @@ -1321,14 +1316,10 @@ public String getValueAsString(int index) {
// If the denominator is a non-zero integral divisor
// of the numerator then convert the fraction to be
// with respect to a unity denominator.
rationalString =
Long.toString(lvalue[0] / lvalue[1]) + "/1";
rationalString = (lvalue[0] / lvalue[1]) + "/1";
} else {
// Use the values directly.
rationalString =
Long.toString(lvalue[0]) +
"/" +
Long.toString(lvalue[1]);
rationalString = lvalue[0] + "/" + lvalue[1];
}
return rationalString;
default:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2015, 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.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -230,7 +230,7 @@ private void fireValueChanged() {
if (lastAdjustedIndex == MIN) {
return;
}
/* If getValueAdjusting() is true, (eg. during a drag opereration)
/* If getValueAdjusting() is true, (eg. during a drag operation)
* record the bounds of the changes so that, when the drag finishes (and
* setValueAdjusting(false) is called) we can post a single event
* with bounds covering all of these individual adjustments.
Expand Down Expand Up @@ -738,7 +738,7 @@ public void setValueIsAdjusting(boolean isAdjusting) {
*/
public String toString() {
String s = ((getValueIsAdjusting()) ? "~" : "=") + value.toString();
return getClass().getName() + " " + Integer.toString(hashCode()) + " " + s;
return getClass().getName() + " " + hashCode() + " " + s;
}

/**
Expand Down Expand Up @@ -825,7 +825,7 @@ public void moveLeadSelectionIndex(int leadIndex) {
* anchor and the new lead are either all selected or all deselected.
* If the value at the anchor index is selected, first clear all the
* values in the range [anchor, oldLeadIndex], then select all the values
* values in the range [anchor, newLeadIndex], where oldLeadIndex is the old
* in the range [anchor, newLeadIndex], where oldLeadIndex is the old
* leadIndex and newLeadIndex is the new one.
* <p>
* If the value at the anchor index is not selected, do the same thing in
Expand Down
12 changes: 6 additions & 6 deletions src/java.desktop/share/classes/javax/swing/GroupLayout.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2006, 2021, 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 @@ -1230,7 +1230,7 @@ private void createSpringDescription(StringBuilder sb, Spring spring,
String padding = "";
if (spring instanceof ComponentSpring) {
ComponentSpring cSpring = (ComponentSpring)spring;
origin = Integer.toString(cSpring.getOrigin()) + " ";
origin = cSpring.getOrigin() + " ";
String name = cSpring.getComponent().getName();
if (name != null) {
origin = "name=" + name + ", ";
Expand Down Expand Up @@ -1885,7 +1885,7 @@ public SequentialGroup addPreferredGap(JComponent comp1,
* @param comp1 the first component
* @param comp2 the second component
* @param type the type of gap
* @param pref the preferred size of the grap; one of
* @param pref the preferred size of the gap; one of
* {@code DEFAULT_SIZE} or a value &gt;= 0
* @param max the maximum size of the gap; one of
* {@code DEFAULT_SIZE}, {@code PREFERRED_SIZE}
Expand Down Expand Up @@ -1944,7 +1944,7 @@ public SequentialGroup addPreferredGap(ComponentPlacement type) {
* @param type the type of gap; one of
* {@code LayoutStyle.ComponentPlacement.RELATED} or
* {@code LayoutStyle.ComponentPlacement.UNRELATED}
* @param pref the preferred size of the grap; one of
* @param pref the preferred size of the gap; one of
* {@code DEFAULT_SIZE} or a value &gt;= 0
* @param max the maximum size of the gap; one of
* {@code DEFAULT_SIZE}, {@code PREFERRED_SIZE}
Expand Down Expand Up @@ -3506,10 +3506,10 @@ private int updateSize(LayoutStyle p, ComponentSpring sourceSpring,

String getMatchDescription() {
if (targets != null) {
return "leading: " + targets.toString();
return "leading: " + targets;
}
if (sources != null) {
return "trailing: " + sources.toString();
return "trailing: " + sources;
}
return "--";
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2014, 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.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -294,14 +294,13 @@ public int[] getChildIndices() {
public String toString() {
StringBuilder sb = new StringBuilder();

sb.append(getClass().getName() + " " +
Integer.toString(hashCode()));
sb.append(getClass().getName() + " " + hashCode());
if(path != null)
sb.append(" path " + path);
if(childIndices != null) {
sb.append(" indices [ ");
for(int counter = 0; counter < childIndices.length; counter++)
sb.append(Integer.toString(childIndices[counter])+ " ");
sb.append(childIndices[counter] + " ");
sb.append("]");
}
if(children != null) {
Expand Down
4 changes: 2 additions & 2 deletions src/java.desktop/share/classes/javax/swing/text/TabStop.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2015, 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.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -181,7 +181,7 @@ public String toString() {
buf = "bar ";
break;
}
buf = buf + "tab @" + String.valueOf(position);
buf = buf + "tab @" + position;
if (leader != LEAD_NONE)
buf = buf + " (w/leaders)";
return buf;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ public void setValueIsAdjusting(boolean isAdjusting) {

public String toString() {
String s = ((getValueIsAdjusting()) ? "~" : "=") + value.toString();
return getClass().getName() + " " + Integer.toString(hashCode()) + " " + s;
return getClass().getName() + " " + hashCode() + " " + s;
turbanoff marked this conversation as resolved.
Show resolved Hide resolved
}

/**
Expand Down Expand Up @@ -499,7 +499,7 @@ public void setAnchorSelectionIndex(int anchorIndex) {
* anchor and the new lead are either all selected or all deselected.
* If the value at the anchor index is selected, first clear all the
* values in the range [anchor, oldLeadIndex], then select all the values
* values in the range [anchor, newLeadIndex], where oldLeadIndex is the old
* in the range [anchor, newLeadIndex], where oldLeadIndex is the old
* leadIndex and newLeadIndex is the new one.
* <p>
* If the value at the anchor index is not selected, do the same thing in reverse,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1174,10 +1174,9 @@ public String toString() {
sb.append(getClass().getName() + " " + hashCode() + " [ ");
for(int counter = 0; counter < selCount; counter++) {
if(rows != null)
sb.append(selection[counter].toString() + "@" +
Integer.toString(rows[counter])+ " ");
sb.append(selection[counter] + "@" + rows[counter] + " ");
else
sb.append(selection[counter].toString() + " ");
sb.append(selection[counter] + " ");
}
sb.append("]");
return sb.toString();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,12 @@ final class RendererContext extends ReentrantContext implements MarlinConst {
*/
static RendererContext createContext() {
return new RendererContext("ctx"
+ Integer.toString(CTX_COUNT.getAndIncrement()));
+ CTX_COUNT.getAndIncrement());
turbanoff marked this conversation as resolved.
Show resolved Hide resolved
}

// Smallest object used as Cleaner's parent reference
private final Object cleanerObj;
// dirty flag indicating an exception occured during pipeline in pathTo()
// dirty flag indicating an exception occurred during pipeline in pathTo()
boolean dirty = false;
// shared data
final double[] double6 = new double[6];
Expand Down
2 changes: 1 addition & 1 deletion src/java.desktop/share/classes/sun/print/PSPrinterJob.java
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,7 @@ protected void startDoc() throws PrinterException {
int cnt = Integer.parseInt(mFontProps.getProperty("font.num", "9"));
for (int i = 0; i < cnt; i++){
mPSStream.println(" /" + mFontProps.getProperty
("font." + String.valueOf(i), "Courier ISOF"));
("font." + i, "Courier ISOF"));
}
}
mPSStream.println("] D");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002, 2021, 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 @@ -470,7 +470,7 @@ public Object clone() {

/**
* Merges the contents of this Style with that of the passed in Style,
* returning the resulting merged syle. Properties of this
* returning the resulting merged style. Properties of this
* <code>DefaultSynthStyle</code> will take precedence over those of the
* passed in <code>DefaultSynthStyle</code>. For example, if this
* style specifics a non-null font, the returned style will have its
Expand Down Expand Up @@ -887,7 +887,7 @@ public String toString() {

sb.append(super.toString()).append(',');

sb.append("state=").append(Integer.toString(state)).append(',');
sb.append("state=").append(state).append(',');

sb.append("font=").append(font).append(',');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ static boolean isWindowsProperty(String name) {
private synchronized void setBooleanProperty(String key, boolean value) {
assert( key != null );
if (log.isLoggable(PlatformLogger.Level.FINE)) {
log.fine(key + "=" + String.valueOf(value));
log.fine(key + "=" + value);
}
map.put(key, Boolean.valueOf(value));
}
Expand All @@ -117,7 +117,7 @@ private synchronized void setBooleanProperty(String key, boolean value) {
private synchronized void setIntegerProperty(String key, int value) {
assert( key != null );
if (log.isLoggable(PlatformLogger.Level.FINE)) {
log.fine(key + "=" + String.valueOf(value));
log.fine(key + "=" + value);
}
map.put(key, Integer.valueOf(value));
}
Expand Down