< prev index next >

src/java.base/share/classes/java/lang/Short.java

Print this page
rev 14117 : 8145468: update java.lang APIs with new deprecations
Reviewed-by: XXX

@@ -300,11 +300,17 @@
      * Constructs a newly allocated {@code Short} object that
      * represents the specified {@code short} value.
      *
      * @param value     the value to be represented by the
      *                  {@code Short}.
+     *
+     * @deprecated
+     * It is rarely appropriate to use this constructor. The static factory
+     * {@link #valueOf(short)} is generally a better choice, as it is
+     * likely to yield significantly better space and time performance.
      */
+    @Deprecated(since="9")
     public Short(short value) {
         this.value = value;
     }
 
     /**

@@ -316,12 +322,18 @@
      *
      * @param s the {@code String} to be converted to a
      *          {@code Short}
      * @throws  NumberFormatException If the {@code String}
      *          does not contain a parsable {@code short}.
-     * @see     java.lang.Short#parseShort(java.lang.String, int)
+     *
+     * @deprecated
+     * It is rarely appropriate to use this constructor.
+     * Use {@link #parseShort(String)} to convert a string to a
+     * {@code short} primitive, or use {@link #valueOf(String)}
+     * to convert a string to a {@code Short} object.
      */
+    @Deprecated(since="9")
     public Short(String s) throws NumberFormatException {
         this.value = parseShort(s, 10);
     }
 
     /**
< prev index next >