RFR: 4511638: Double.toString(double) sometimes produces incorrect results [v11]

Joe Darcy darcy at openjdk.java.net
Tue May 10 19:15:50 UTC 2022


On Tue, 10 May 2022 15:50:26 GMT, Raffaello Giulietti <duke at openjdk.java.net> wrote:

> `[Float|Double]ToDecimal` do not have access to `AbstractStringBuilder`, so have to fail over `Appendable`, which can throw `IOException` in `append(*)` methods.
> 
> I have to find another way if this wrapping to make the compiler happy is unacceptable.

Ah, I haven't used it myself recently enough to recall the details, but I believe the shared secrets mechanism is intended to allow such cross-package access.

If the current code is kept and if the exception can actually be thrown, explicitly throwing an assertion error is preferable to "assert false".

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

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


More information about the core-libs-dev mailing list