RFR: 8263038: Optimize String.format for simple specifiers [v2]

Claes Redestad redestad at openjdk.java.net
Mon Mar 8 18:58:10 UTC 2021


On Mon, 8 Mar 2021 17:23:05 GMT, Naoto Sato <naoto at openjdk.org> wrote:

>> Claes Redestad has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Lazily evaluate zero
>
> src/java.base/share/classes/java/util/Formatter.java line 2447:
> 
>> 2445:     private char zero() {
>> 2446:         char zero = this.zero;
>> 2447:         if (zero == 0) {
> 
> U+0000 is a valid character. Although it's almost no possibility where any locale assigns it as the zero in it, theoretically it is possible. It can be avoided by comparing it with a non-character, such as BOM (U+FFFE)

Ok, maybe a bit too defensive, but let's use BOM instead.

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

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


More information about the core-libs-dev mailing list