<i18n dev> RFR: 8333396: Performance regression of DecimalFormat.format [v8]

lingjun-cg duke at openjdk.org
Wed Jun 19 02:24:15 UTC 2024


On Wed, 19 Jun 2024 02:12:01 GMT, lingjun-cg <duke at openjdk.org> wrote:

>> src/java.base/share/classes/java/text/Format.java line 278:
>> 
>>> 276:      *         {@code false} otherwise
>>> 277:      */
>>> 278:     boolean isInternalSubclass() {
>> 
>> Since this is defined in Format, can we apply similar changes of StringBuilder formatting to the other Format subclasses beyond just NumberFormat.
>> 
>> For example, in DateFormat, something such as,
>> 
>> 
>> <T extends Appendable & CharSequence> T formatWithGeneric(Date date,
>>                                                    T toAppendTo,
>>                                                    FieldPosition pos) {
>>         throw new UnsupportedOperationException("Subclasses should override this method");
>> }
>
> ok. I will update it if we have a conclusion about using  `StringBuf` or using `<T extends Appendable & CharSequence>`.

This  comment inspire me that  use '<T extends Appendable & CharSequence>' in `SimpleDateFormat` is impossible, because the 'Appendable' lack of necessary `append` method which SimpleDateFormat requires.
So we need discuss whether `StringBuf` is a better solution?

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

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


More information about the i18n-dev mailing list