RFR: JDK-8261422: Adjust problematic String.format calls in jdk/internal/util/Preconditions.java outOfBoundsMessage

Christoph Langer clanger at openjdk.java.net
Fri Feb 12 11:05:40 UTC 2021


On Tue, 9 Feb 2021 14:33:22 GMT, Matthias Baesken <mbaesken at openjdk.org> wrote:

> JDK-8261422: Adjust problematic String.format calls in jdk/internal/util/Preconditions.java outOfBoundsMessage

As we're potentially formatting any "Number" type here, theoretically floats could be passed which would result in an Exception. In fact, only decimal types are passed by the callers so this should not happen. Unfortunately there's no super type specifying decimal numbers.

And as we're not doing some fancy formatting but just %d, I think replacing this with %s should be ok.

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

Marked as reviewed by clanger (Reviewer).

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


More information about the core-libs-dev mailing list