6628737: Specification of wrapper class valueOf static factories should require caching
authordarcy
Thu, 09 Jul 2009 12:31:30 -0700
changeset 3224 3aa65803ae07
parent 3223 24e98ad0c62e
child 3225 023603ebeb1f
6628737: Specification of wrapper class valueOf static factories should require caching Reviewed-by: mr
jdk/src/share/classes/java/lang/Byte.java
jdk/src/share/classes/java/lang/Character.java
jdk/src/share/classes/java/lang/Integer.java
jdk/src/share/classes/java/lang/Long.java
jdk/src/share/classes/java/lang/Short.java
--- a/jdk/src/share/classes/java/lang/Byte.java	Wed Jul 08 09:12:17 2009 -0700
+++ b/jdk/src/share/classes/java/lang/Byte.java	Thu Jul 09 12:31:30 2009 -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
-     * significantly better space and time performance by caching
-     * frequently requested values.
+     * significantly better space and time performance since
+     * all byte values are cached.
      *
      * @param  b a byte value.
      * @return a {@code Byte} instance representing {@code b}.
--- a/jdk/src/share/classes/java/lang/Character.java	Wed Jul 08 09:12:17 2009 -0700
+++ b/jdk/src/share/classes/java/lang/Character.java	Thu Jul 09 12:31:30 2009 -0700
@@ -2571,6 +2571,10 @@
      * significantly better space and time performance by caching
      * frequently requested values.
      *
+     * This method will always cache values in the range '\u0000'
+     * to '\u007f'", inclusive, and may cache other values outside
+     * of this range.
+     *
      * @param  c a char value.
      * @return a <tt>Character</tt> instance representing <tt>c</tt>.
      * @since  1.5
--- a/jdk/src/share/classes/java/lang/Integer.java	Wed Jul 08 09:12:17 2009 -0700
+++ b/jdk/src/share/classes/java/lang/Integer.java	Thu Jul 09 12:31:30 2009 -0700
@@ -638,6 +638,9 @@
      * to yield significantly better space and time performance by
      * caching frequently requested values.
      *
+     * This method will always cache values in the range -128 to 127,
+     * inclusive, and may cache other values outside of this range.
+     *
      * @param  i an {@code int} value.
      * @return an {@code Integer} instance representing {@code i}.
      * @since  1.5
--- a/jdk/src/share/classes/java/lang/Long.java	Wed Jul 08 09:12:17 2009 -0700
+++ b/jdk/src/share/classes/java/lang/Long.java	Thu Jul 09 12:31:30 2009 -0700
@@ -560,6 +560,11 @@
      * significantly better space and time performance by caching
      * frequently requested values.
      *
+     * Note that unlike the {@linkplain Integer#valueOf(int)
+     * corresponding method} in the {@code Integer} class, this method
+     * is <em>not</em> required to cache values within a particular
+     * range.
+     *
      * @param  l a long value.
      * @return a {@code Long} instance representing {@code l}.
      * @since  1.5
--- a/jdk/src/share/classes/java/lang/Short.java	Wed Jul 08 09:12:17 2009 -0700
+++ b/jdk/src/share/classes/java/lang/Short.java	Thu Jul 09 12:31:30 2009 -0700
@@ -219,6 +219,9 @@
      * significantly better space and time performance by caching
      * frequently requested values.
      *
+     * This method will always cache values in the range -128 to 127,
+     * inclusive, and may cache other values outside of this range.
+     *
      * @param  s a short value.
      * @return a {@code Short} instance representing {@code s}.
      * @since  1.5