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

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

The method outOfBoundsMessage has a few problematic calls to String.format.
Those calls use "%d" however the arguments are of type Number, so we should 
better use %s .

Example :

https://sonarcloud.io/project/issues?id=shipilev_jdk&languages=java&open=AXcqM87A8sPJZZzON5wY&resolved=false&severities=BLOCKER&types=BUG

return String.format("Index %d out of bounds for length %d",
                     args.get(0), args.get(1));

Sonar error :
An 'int' is expected rather than a .

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

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

Reply via email to