RFR - 6480539: BigDecimal.stripTrailingZeros() should specify no-op on zero BigDecimals

Stephen Colebourne scolebourne at joda.org
Wed Feb 6 23:16:37 UTC 2013


On 5 February 2013 09:09, Paul Sandoz <paul.sandoz at oracle.com> wrote:
> This is one of those unfortunate cases where a bug can become a feature.

I *really* don't see how.

The method name is absolutely clear about its purpose. "Strip trailing
zeros". Anyone relying on it not stripping zeroes for zero needs their
head examining.

This particular one just happens to be one that I've run across twice
and in both cases it required a workaround. I'd argue that there are
more people with undiscovered bugs in their code because the method is
buggy than people who would break were the method fixed.

What bothers me even more is the desire expressed in this thread to
simply wish away bugs by redefining the documentation. If the method
name is clear enough, like in this case, then its a bug, and a
documentation change simply isn't the right solution.
Stephen



More information about the core-libs-dev mailing list