提交 60a92837 编写于 作者: D darcy

6480728: Byte.valueOf(byte) returns a cached value but Byte.valueOf(String)

6655735: Integer.toString() and String.valueOf(int) contain slow delegations
Reviewed-by: lancea
上级 6404fb81
......@@ -201,7 +201,7 @@ public final class Byte extends Number implements Comparable<Byte> {
*/
public static Byte valueOf(String s, int radix)
throws NumberFormatException {
return new Byte(parseByte(s, radix));
return valueOf(parseByte(s, radix));
}
/**
......@@ -277,7 +277,7 @@ public final class Byte extends Number implements Comparable<Byte> {
if (i < MIN_VALUE || i > MAX_VALUE)
throw new NumberFormatException(
"Value " + i + " out of range from input " + nm);
return (byte)i;
return valueOf((byte)i);
}
/**
......@@ -374,7 +374,7 @@ public final class Byte extends Number implements Comparable<Byte> {
* base&nbsp;10.
*/
public String toString() {
return String.valueOf((int)value);
return Integer.toString((int)value);
}
/**
......
......@@ -629,7 +629,7 @@ public final class Double extends Number implements Comparable<Double> {
* @see java.lang.Double#toString(double)
*/
public String toString() {
return String.valueOf(value);
return toString(value);
}
/**
......
......@@ -551,7 +551,7 @@ public final class Float extends Number implements Comparable<Float> {
* @see java.lang.Float#toString(float)
*/
public String toString() {
return String.valueOf(value);
return Float.toString(value);
}
/**
......
......@@ -746,7 +746,7 @@ public final class Integer extends Number implements Comparable<Integer> {
* base&nbsp;10.
*/
public String toString() {
return String.valueOf(value);
return toString(value);
}
/**
......
......@@ -761,7 +761,7 @@ public final class Long extends Number implements Comparable<Long> {
* base&nbsp;10.
*/
public String toString() {
return String.valueOf(value);
return toString(value);
}
/**
......
......@@ -170,7 +170,7 @@ public final class Short extends Number implements Comparable<Short> {
*/
public static Short valueOf(String s, int radix)
throws NumberFormatException {
return new Short(parseShort(s, radix));
return valueOf(parseShort(s, radix));
}
/**
......@@ -282,7 +282,7 @@ public final class Short extends Number implements Comparable<Short> {
if (i < MIN_VALUE || i > MAX_VALUE)
throw new NumberFormatException(
"Value " + i + " out of range from input " + nm);
return (short)i;
return valueOf((short)i);
}
/**
......@@ -379,7 +379,7 @@ public final class Short extends Number implements Comparable<Short> {
* base&nbsp;10.
*/
public String toString() {
return String.valueOf((int)value);
return Integer.toString((int)value);
}
/**
......
......@@ -2995,7 +2995,7 @@ public final class String
* @see java.lang.Integer#toString(int, int)
*/
public static String valueOf(int i) {
return Integer.toString(i, 10);
return Integer.toString(i);
}
/**
......@@ -3009,7 +3009,7 @@ public final class String
* @see java.lang.Long#toString(long)
*/
public static String valueOf(long l) {
return Long.toString(l, 10);
return Long.toString(l);
}
/**
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册