On Mon, 1 Jul 2024 16:28:09 GMT, ExE Boss <d...@openjdk.org> wrote:

>> j.u.Formatter supports args == null
>
> When `args == null` or `args.length == 0`, then the format string can still 
> contain `%%` or `%n`, and those will be formatted to `"%"` and 
> [`System​.lineSeparator()`] respectively.
> 
> [`System​.lineSeparator()`]: 
> https://docs.oracle.com/en/java/javase/22/docs/api/java.base/java/lang/System.html#lineSeparator()

Yeah, if args is null or empty and there are format specifiers in the format 
string it should throw `IllegalFormatException`. To @liach ’s earlier comments, 
`String.format` likely needs more exhaustive unit tests covering various 
positive and negative test cases.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/19956#discussion_r1661553502

Reply via email to