6480539: BigDecimal.stripTrailingZeros() should specify no-op on zero BigDecimals (original) (raw)
Stephen Colebourne scolebourne at joda.org
Mon Feb 4 21:36:30 UTC 2013
- Previous message: RFR - 6480539: BigDecimal.stripTrailingZeros() should specify no-op on zero BigDecimals
- Next message: RFR - 6480539: BigDecimal.stripTrailingZeros() should specify no-op on zero BigDecimals
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 4 February 2013 19:31, Joe Darcy <joe.darcy at oracle.com> wrote:
The stripTrailingZeros method has acted in this surprising way since the IBM-led JSR 13 was integrated into the platform back in JDK 5, which shipped in 2004.
This situation is analogous to when the specification and behavior disagree. Our general policy to resolve such cases when evolving the JDK is: "..., there are times in evolving the JDK when differences are found between the specified behavior and the actual behavior (for example 4707389, 6365176). The two basic approaches to fixing these bugs are to change the implementation to match the specified behavior or to change the specification (in a platform release) to match the implementation's (perhaps long-standing) behavior; often the latter option is chosen since it has a lower de facto impact on behavioral compatibility." http://cr.openjdk.java.net/~darcy/OpenJdkDevGuide/OpenJdkDevelopersGuide.v0.777.html If this issue were being addressed before JDK 5 shipped or even during JDK 6, I would support changing the behavior of stripTrailingZeros. However, for addressing this in JDK 8, I think it is more appropriate to keep the behavior as-is and document this special case.
I don't see what JDK 5 vs 6 vs 8 really has to do with it. Sun/Oracle has a large bug backlog, and this is just one of them. Fixing it is not that hard, and I can't see how fixing it would be risky to the world's applications.
Without this, people like us (OpenGamma) have to have work-arounds: https://github.com/OpenGamma/OG-Platform/blob/master/projects/OG-Util/src/main/java/com/opengamma/util/JdkUtils.java#L26
Stephen
- Previous message: RFR - 6480539: BigDecimal.stripTrailingZeros() should specify no-op on zero BigDecimals
- Next message: RFR - 6480539: BigDecimal.stripTrailingZeros() should specify no-op on zero BigDecimals
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]