On Sat, 23 Dec 2023 15:22:58 GMT, Eamonn McManus <emcma...@openjdk.org> wrote:

>> Multiplying with `*` never produces `ArithmeticException`, so the catch in 
>> the existing code is never triggered. `Math.multiplyExact` does produce 
>> `ArithmeticException` if the multiplication overflows. So we can use that, 
>> and rethrow `IllegalArgumentException` as the specification says.
>> 
>> There is a small compatibility risk, in that code may have been relying on 
>> the previous silent overflow, and will now get an exception. But an 
>> exception is surely better than the nonsense results that overflow produces.
>> 
>> Thanks to Kurt Kluever for the test cases.
>
> Eamonn McManus has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   Update copyright year.

Marked as reviewed by rgiulietti (Reviewer).

-------------

PR Review: https://git.openjdk.org/jdk/pull/17181#pullrequestreview-1795472693

Reply via email to