On Wed, 29 Apr 2026 22:51:12 GMT, Naoto Sato <[email protected]> wrote:

>> Enabling customization of localized format patterns for the `java.time` 
>> date/time formatters through the locale-sensitive SPI. While existing SPIs 
>> allow customization of textual elements, such as month-of-year names, 
>> formatting patterns (e.g., "dd/MM/yyyy") cannot currently be customized for 
>> a given locale.
>> 
>> This enhancement is needed to support customers migrating from the 
>> now-removed COMPAT locale resources to CLDR-based ones.
>> 
>> ---------
>> - [x] I confirm that I make this contribution in accordance with the 
>> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai).
>
> Naoto Sato has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   Addressing review comments

Overall this change looks good to me. I left some more minor comments.

src/java.base/macosx/classes/sun/util/locale/provider/HostLocaleProviderAdapterImpl.java
 line 176:

> 174:             @Override
> 175:             public String getDateTimeFormatterPattern(String 
> requestedTemplate, String calType, Locale locale) {
> 176:                 throw new DateTimeException("""

If there is time, I think adding a HOST specific test/run that confirms this 
behavior would help with coverage. As far as I can tell there aren't any 
existing tests before this PR that accomplished that.

src/java.base/share/classes/sun/util/locale/provider/LocaleServiceProviderPool.java
 line 91:

> 89:         java.text.spi.DecimalFormatSymbolsProvider.class,
> 90:         java.text.spi.NumberFormatProvider.class,
> 91:         java.time.format.DateTimeFormatterPatternProvider.class,

nit: this change requires a copyright year update as well now.

test/jdk/java/util/PluggableLocale/DateTimeFormatterPatternProviderTest.java 
line 155:

> 153:     public void testGetLocalizedDateTimePattern_4args(FormatStyle 
> dateStyle, FormatStyle timeStyle, String calType, Locale loc) {
> 154:         assertEquals("'date style: " + dateStyle + ", timeStyle: " + 
> timeStyle + ", calType: " + calType + ", loc: " + loc + "'",
> 155:             new 
> DateTimeFormatterBuilder().getLocalizedDateTimePattern(dateStyle, timeStyle, 
> Chronology.of(calType), loc));

nit: feels odd to create instances when we're calling static methods.

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

Marked as reviewed by jlu (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/30979#pullrequestreview-4206819924
PR Review Comment: https://git.openjdk.org/jdk/pull/30979#discussion_r3169416008
PR Review Comment: https://git.openjdk.org/jdk/pull/30979#discussion_r3169436282
PR Review Comment: https://git.openjdk.org/jdk/pull/30979#discussion_r3169400401

Reply via email to