Review: JDK 8 CR for Support Integer overflow

Eamonn McManus eamonn at
Mon Feb 6 22:19:25 UTC 2012

Looks good to me (emcmanus). One really trivial thing is that is indented one space too far. I thought that the common
(int)value subexpression could be put in a variable in toIntExact but
it turns out that javac generates more code in that case.


On 6 February 2012 13:16, Roger Riggs <Roger.Riggs at> wrote:
> Thanks for the review and comments:
> The comments and suggestions are included in the updated webrev:
>  * Corrected error in multipleExact(long,long) with the special case
>   Long.MIN_VALUE * -1.
>  * Verified that retaining the optimization for small (2^31) arguments
>   is worthwhile,
>   not doing the divide saves about 1/2 on the execution time.
>  * Removed the negateExact methods since they don't pull their weight
>   in the API,
>   simple tests for MIN_VALUE and MAX_VALUE can be done by the
>   developer more efficiently.
>  * Simplified the arguments to the ArithmeticExceptions to be simple
>   strings since
>   debugging this kind of exception requires the source code.
>  * Expanded the comments in the implementation include descriptions and
>   references to the Hackers Delight where they are used.
>  * Updated the tests to include missing test cases
> More comments, please
> Thanks, Roger

More information about the core-libs-dev mailing list