> 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. ------------- Changes: - all: https://git.openjdk.org/jdk/pull/17181/files - new: https://git.openjdk.org/jdk/pull/17181/files/8f2e929c..9f3cbf12 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=17181&range=02 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=17181&range=01-02 Stats: 2 lines in 2 files changed: 0 ins; 0 del; 2 mod Patch: https://git.openjdk.org/jdk/pull/17181.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/17181/head:pull/17181 PR: https://git.openjdk.org/jdk/pull/17181