Summary
JDK-8183912 introduced an optimization for the cases BigDecimal.movePoint[Left|Right](0)
to always return this
. While the spec never claims to return this
, it might be the case that consumers incautiously rely on such behavior.
Problem
This behavior is at odds with the methods' own spec, which prescribes a specific scale for the result, even when the argument is 0. In particular, when the scale is negative, the methods must return an instance which is not equals()
to this
(even less so, identical ==
).
Solution
The proposed changes re-align the behavior with the spec.
Specification
The specification is not changed in any way. It's only an implementation change, although the change is behaviorally observable. Consumers of these API points that rely on the methods to always return this when the argument is 0 should be updated.
- csr of
-
JDK-8289260 BigDecimal movePointLeft() and movePointRight() do not follow their API spec
- Closed