spring-data-redis icon indicating copy to clipboard operation
spring-data-redis copied to clipboard

Replace `String.format("..", args)` with `"..".formatted(args)`

Open jxblum opened this issue 2 years ago • 0 comments

See #2751.

Please read the description in #2751.

I also think formatted Strings work nicer if natural line breaks are preserved.

For example:

throw new IllegalArgumentException("some message with placeholders"
    .formatted(arg1, arg2, ..., argN);

Rather than this non-sense:

throw new IllegalArgumentException("some message with placeholders".formatted(arg1, arg2, ...,
    argN);

That is orphans, or even partly broken argument lists.

Finally...

This is not strictly necessary. But, in my opinion, I think this is a nice improvement over our existing String formatting.

I also took the opportunity to clean up a (minimal) few compiler warnings while stumbling across message formatting.

Also, I changed a couple assertions that unnecessarily used a Supplier that did not need to and added Suppliers to a few assertions that should have had them.

jxblum avatar Oct 19 '23 22:10 jxblum