<i18n dev> RFR: 8335366: Improve String.format performance with fastpath [v5]
David Schlosnagle
duke at openjdk.org
Mon Jul 1 21:23:19 UTC 2024
On Mon, 1 Jul 2024 16:28:09 GMT, ExE Boss <duke at 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
More information about the i18n-dev
mailing list