JDK-8191501 : Add java.time.format.DateTimeFormatter localizedBy(locale) method to reflect Unicode extensions
  • Type: CSR
  • Component: core-libs
  • Sub-Component: java.time
  • Priority: P3
  • Status: Closed
  • Resolution: Approved
  • Fix Versions: 10
  • Submitted: 2017-11-17
  • Updated: 2017-11-30
  • Resolved: 2017-11-30
Related Reports
CSR :  
Description
Summary
-------

Add java.time.format.DateTimeFormatter localizedBy(locale) to reflect "ca", "nu", "tz", and/or "rg" Unicode extensions

Problem
-------

JEP 314 introduces additional Unicode extensions, such as "tz" time zone extension. To utilize this extension, a new method, localizedBy(Locale), needs to be introduced in java.time.format.DateTimeFormatter class. There has been the method "withLocale(Locale)" which applies text and/or pattern localization to the formatter, but the effect is independent of other withXXXX() method invocations, such as withZone(). Modifying withLocale() to recognize Unicode extensions would break that assumption. Thus the localizedBy(Locale) is needed to override the locale defaults.

Solution
--------

Introduce a new method, localizedBy(Locale), that reflects the elements in the specified locale, and overrides the locale defaults in the formatter. Also, added some clarifications to java.time.format.DecimalStyle.of(), java.time.format.DateTimeFormatterBuilder.getLocalizedDateTimePattern() and java.util.Calendar.getInstance() methods.

Specification
-------------

http://cr.openjdk.java.net/~naoto/8191349/specdiff.04/overview-summary.html
Comments
After discussion with Naoto, moving to approved.
30-11-2017

The specdiff in the "Specification" is the one from the approved CSR JDK-8186697, which is not integrated yet. The specdiff from unmodified JDK10 is located here (as well as attachment): http://cr.openjdk.java.net/~naoto/8191349/specdiff.barejdk10/overview-summary.html
28-11-2017