JDK 9 RFR of 8067669: Documentation for methods in Number incomplete regarding too large values.

Andreas Lundblad andreas.lundblad at oracle.com
Wed Jan 7 08:08:38 UTC 2015

On Mon, Jan 05, 2015 at 05:43:26PM -0800, Joseph D. Darcy wrote:
> Hello,
> Getting back to this issue in the new year, taking a closer look at
> the existing class-level documentation, I don't really see a
> compelling case for an edit this large.
> I for one would be content if the bug were closed as "not an issue."
> HTH,
> -Joe

I originally brought this up when I was trying to create a Comparator<Number>. In my use case I was fine with rounding and truncation, so I thougth I could safely use longValue. I was then surprised when I discovered that the method could basically return arbitrary long values.

In retrospect I realize that one could interpret "[...] which may involve rounding or truncation" as "may involve rounding or truncation or something else". Nevertheless I find the current formulation a bit confusing. Maybe it's just me.

-- Andreas

More information about the core-libs-dev mailing list