<i18n dev> RFR: 8333396: Use StringBuilder internally for java.text.Format.* formatting [v21]

Roger Riggs rriggs at openjdk.org
Fri Jul 19 14:32:39 UTC 2024


On Fri, 19 Jul 2024 13:03:31 GMT, Chen Liang <liach at openjdk.org> wrote:

>> lingjun-cg has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   8333396: Use StringBuilder internally for java.text.Format.* formatting
>
> src/java.base/share/classes/java/text/Format.java line 164:
> 
>> 162:      */
>> 163:     public final String format (Object obj) {
>> 164:         if ("java.text".equals(getClass().getPackageName())) {
> 
> We can use `==` for performance as getPackageName is interned.

Using equals() is fine and the performance is the same.
Using "==" may be fewer characters but carries with it the need to understand that the arguments are interned and that's not always obvious or known.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/19513#discussion_r1684469032


More information about the i18n-dev mailing list