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

stefan-zobel github.com+18482851+stefan-zobel at openjdk.java.net
Tue Feb 9 16:06:40 UTC 2021


On Tue, 9 Feb 2021 15:47:39 GMT, Matthias Baesken <mbaesken at openjdk.org> wrote:

>> src/java.base/share/classes/jdk/internal/util/Preconditions.java line 212:
>> 
>>> 210:                                      args.get(0), args.get(1), args.get(2));
>>> 211:             case "checkFromIndexSize":
>>> 212:                 return String.format("Range [%s, %<s + %s) out of bounds for length %s",
>> 
>> I assume we have a code coverage here and that we need tests to exercise these code paths.
>
> I haven't written the class Preconditions.java, this question should probably go to the authors .
> I found the String.format syntax a bit  unusual,  should this be rewritten ?

AFAIK, Preconditions was introduced in https://bugs.openjdk.java.net/browse/JDK-8155794

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

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


More information about the core-libs-dev mailing list