Code review request for 6628737: Specification of wrapper class valueOf static factories should require caching (original) (raw)

Joseph D. Darcy Joe.Darcy at Sun.COM
Thu Jul 9 01:49:54 UTC 2009


Hello.

Since JDK 5, to implement autoboxing, javac has relied on various static factory methods in the wrapper classes to perform the caching in the required range. While the factories said they could cache, they did not state they would definitely cache in the required range given in JLSv3 section 5.1.7: http://java.sun.com/docs/books/jls/third_edition/html/conversions.html#5.1.7

Please review the patch below of my specification changes to mandate the caching. The Boolean factory already mandates caching. (For those interested in such things, tn parallel a ccc request has been filed to track the specification change.)

-Joe

--- old/src/share/classes/java/lang/Byte.java 2009-07-08 18:38:11.000000000 -0700 +++ new/src/share/classes/java/lang/Byte.java 2009-07-08 18:38:11.000000000 -0700 @@ -90,8 +90,8 @@ * If a new {@code Byte} instance is not required, this method * should generally be used in preference to the constructor * {@link #Byte(byte)}, as this method is likely to yield

--- old/src/share/classes/java/lang/Character.java 2009-07-08 18:38:13.000000000 -0700 +++ new/src/share/classes/java/lang/Character.java 2009-07-08 18:38:13.000000000 -0700 @@ -2571,6 +2571,10 @@ * significantly better space and time performance by caching * frequently requested values. *

--- old/src/share/classes/java/lang/Integer.java 2009-07-08 18:38:14.000000000 -0700 +++ new/src/share/classes/java/lang/Integer.java 2009-07-08 18:38:14.000000000 -0700 @@ -638,6 +638,9 @@ * to yield significantly better space and time performance by * caching frequently requested values. *

--- old/src/share/classes/java/lang/Long.java 2009-07-08 18:38:16.000000000 -0700 +++ new/src/share/classes/java/lang/Long.java 2009-07-08 18:38:16.000000000 -0700 @@ -560,6 +560,11 @@ * significantly better space and time performance by caching * frequently requested values. *

--- old/src/share/classes/java/lang/Short.java 2009-07-08 18:38:17.000000000 -0700 +++ new/src/share/classes/java/lang/Short.java 2009-07-08 18:38:17.000000000 -0700 @@ -219,6 +219,9 @@ * significantly better space and time performance by caching * frequently requested values. *



More information about the core-libs-dev mailing list