RFR: 8264161: BigDecimal#stripTrailingZeros can throw undocumented ArithmeticException

Brian Burkhalter bpb at openjdk.java.net
Thu Mar 25 19:42:26 UTC 2021


On Thu, 25 Mar 2021 19:30:01 GMT, Joe Darcy <darcy at openjdk.org> wrote:

> While some of the existing text in BigDecimal could be read as implying exponent overflow/underflow will throw an ArithmeticException, it is reasonable to simply state that explicitly.
> 
> The next text is meant to cover the usage of the checkScale family of methods.
> 
> I'll reflow the existing paragraph once the text is agreed to.

src/java.base/share/classes/java/math/BigDecimal.java line 200:

> 198:  * but bounded. If the scale of a result would exceed the range of a
> 199:  * 32-bit integer, either by overflow or underflow, the operation may
> 200:  * throw {@code ArithmeticException}.

Do we need an indefinite article here, e.g., `throw an`?

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

PR: https://git.openjdk.java.net/jdk/pull/3204


More information about the core-libs-dev mailing list