< prev index next >

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

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

*** 500,520 **** --- 500,532 ---- /** * Constructs a newly allocated {@code Float} object that * represents the primitive {@code float} argument. * * @param value the value to be represented by the {@code Float}. + * + * @deprecated + * It is rarely appropriate to use this constructor. The static factory + * {@link #valueOf(float)} is generally a better choice, as it is + * likely to yield significantly better space and time performance. */ + @Deprecated(since="9") public Float(float value) { this.value = value; } /** * Constructs a newly allocated {@code Float} object that * represents the argument converted to type {@code float}. * * @param value the value to be represented by the {@code Float}. + * + * @deprecated + * It is rarely appropriate to use this constructor. Instead, use the + * static factory method {@link #valueOf(float)} method as follows: + * {@code Float.valueOf((float)value)}. */ + @Deprecated(since="9") public Float(double value) { this.value = (float)value; } /**
*** 524,535 **** * {@code float} value as if by the {@code valueOf} method. * * @param s a string to be converted to a {@code Float}. * @throws NumberFormatException if the string does not contain a * parsable number. ! * @see java.lang.Float#valueOf(java.lang.String) */ public Float(String s) throws NumberFormatException { value = parseFloat(s); } /** --- 536,553 ---- * {@code float} value as if by the {@code valueOf} method. * * @param s a string to be converted to a {@code Float}. * @throws NumberFormatException if the string does not contain a * parsable number. ! * ! * @deprecated ! * It is rarely appropriate to use this constructor. ! * Use {@link #parseFloat(String)} to convert a string to a ! * {@code float} primitive, or use {@link #valueOf(String)} ! * to convert a string to a {@code Float} object. */ + @Deprecated(since="9") public Float(String s) throws NumberFormatException { value = parseFloat(s); } /**
< prev index next >