# HG changeset patch # User bpb # Date 1419273319 28800 # Mon Dec 22 10:35:19 2014 -0800 # Node ID 7a78eb598150b3915cb0744a570e5012680c6889 # Parent a2fe66dd6246f6156d4dd058d2778d8641e3be34 8067669: Documentation for methods in Number incomplete regarding too large values. Summary: Update documentation of {double,float,int,long}Value() methods to accommodate non-primitive numerical types. Reviewed-by: TBD diff --git a/src/java.base/share/classes/java/lang/Number.java b/src/java.base/share/classes/java/lang/Number.java --- a/src/java.base/share/classes/java/lang/Number.java +++ b/src/java.base/share/classes/java/lang/Number.java @@ -54,38 +54,54 @@ */ public abstract class Number implements java.io.Serializable { /** - * Returns the value of the specified number as an {@code int}, - * which may involve rounding or truncation. + * Returns the value of the specified number as an {@code int}. The + * particular semantics of the conversion operation from the specified + * number to an {@code int} are defined in subclasses. The operation may + * involve a narrowing conversion, rounding, or truncation. * * @return the numeric value represented by this object after conversion * to type {@code int}. + * + * @jls 5.1.3 Narrowing Primitive Conversions */ public abstract int intValue(); /** - * Returns the value of the specified number as a {@code long}, - * which may involve rounding or truncation. + * Returns the value of the specified number as a {@code long}. The + * particular semantics of the conversion operation from the specified + * number to a {@code long} are defined in subclasses. The operation may + * involve a narrowing conversion, rounding, or truncation. * * @return the numeric value represented by this object after conversion * to type {@code long}. + * + * @jls 5.1.3 Narrowing Primitive Conversions */ public abstract long longValue(); /** - * Returns the value of the specified number as a {@code float}, - * which may involve rounding. + * Returns the value of the specified number as a {@code float}. The + * particular semantics of the conversion operation from the specified + * number to a {@code float} are defined in subclasses. The operation may + * involve a narrowing conversion, rounding, or truncation. * * @return the numeric value represented by this object after conversion * to type {@code float}. + * + * @jls 5.1.3 Narrowing Primitive Conversions */ public abstract float floatValue(); /** - * Returns the value of the specified number as a {@code double}, - * which may involve rounding. + * Returns the value of the specified number as a {@code double}. The + * particular semantics of the conversion operation from the specified + * number to a {@code double} are defined in subclasses. The operation may + * involve a narrowing conversion, rounding, or truncation. * * @return the numeric value represented by this object after conversion * to type {@code double}. + * + * @jls 5.1.3 Narrowing Primitive Conversions */ public abstract double doubleValue();