Affects: 6.0.11 (possibly earlier) up to latest commit in main branch


The class ExponentialBackOff has its toString() method defined in the wrong place:

https://github.com/spring-projects/spring-framework/blob/7e511931b305edc84eb04a219c277a6c8fdcba59/spring-core/src/main/java/org/springframework/util/backoff/ExponentialBackOff.java#L257

It is not defined for ExponentialBackOff itself, but for the inner class ExponentialBackOffExecution.

Thus, the following will print the hashCode instead of the nicely formatted output that was intended:

    System.out.println(new ExponentialBackoff(...))

Comment From: snicoll

instead of the nicely formatted output that was intended:

That's actually the right place, albeit perhaps the wrong prefix. You can't move that nice toString as it contains the interval and multiplier that are specific to the execution.

So there's a toString missing on ExponentialBackOff rather, and perhaps the existing toString should make it more clear it's about an execution.