JDK-8305402 : Emit warning for removal of `COMPAT` provider
  • Type: CSR
  • Component: core-libs
  • Sub-Component: java.util:i18n
  • Priority: P4
  • Status: Closed
  • Resolution: Approved
  • Fix Versions: 21
  • Submitted: 2023-03-31
  • Updated: 2023-05-12
  • Resolved: 2023-04-05
Related Reports
CSR :  
Description
Summary
-------

Emit a warning for removal message if `COMPAT` is specified with `java.locale.providers` system property

Problem
-------

`COMPAT` locale provider has remained to keep the backward compatibility of JDK 8's locale data, since CLDR-based locale data became the default in JDK 9. The intention was to encourage applications to migrate to CLDR, so for future removal of the `COMPAT` locale provider, acknowledging the user of future removal is recommended.

Solution
--------

If `COMPAT` and/or `JRE` is specified in the command line option of `java.locale.providers` system property, print a message warning the user of future removal. Also, replace the wording of the defunct "Java Runtime Environment" with "JDK Reference Implementation."

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

Modify the class description of `java.util.spi.LocaleServiceProvider` class as follows:

    @@ -118,22 +118,23 @@
       * the locale sensitive services separated by a comma. As this property value is
       * read and cached only at the initialization of this class, users should specify the
       * property on the java launcher command line. Setting it at runtime with
       * {@link System#setProperty(String, String)} is discouraged and it may not affect
       * the order.
    -  * <p>
    -  * Java Runtime Environment provides the following four locale providers:
    +  * JDK Reference Implementation provides the following four
    +  * locale providers:
       * <ul>
       * <li> "CLDR": A provider based on Unicode Consortium's
       * <a href="http://cldr.unicode.org/">CLDR Project</a>.
       * <li> "COMPAT": represents the locale sensitive services that is compatible
    -  * with the prior JDK releases up to JDK8 (same as JDK8's "JRE").
    +  * with the prior JDK releases up to JDK 8 (same as JDK 8's "JRE"). This
    +  * provider is deprecated and will be removed in the future release of JDK.
       * <li> "SPI": represents the locale sensitive services implementing the subclasses of
       * this {@code LocaleServiceProvider} class.
       * <li> "HOST": A provider that reflects the user's custom settings in the
       * underlying operating system. This provider may not be available, depending
    -  * on the Java Runtime Environment implementation.
    +  * on the JDK Reference Implementation.
       * <li> "JRE": represents a synonym to "COMPAT". This name
       * is deprecated and will be removed in the future release of JDK.
       * </ul>
       * <p>
       * For example, if the following is specified in the property:
Comments
Moving to Approved.
05-04-2023

The review of this issue has shined a light on how the java.locale.providers system property is defined and whether the values are standard or JDK specific. A follow-on issue JDK-8305595 will address this. In the mean-time, emitting a warning when legacy/unmaintained JRE locale data is used is good.
04-04-2023

The legacy JRE locale data has not been maintained for several years. There are projects with locale sensitive tests that run the tests with the system property set to "COMPAT" to avoid needing to update tests when there are formatting changes. Giving these projects a heads-up with a warning is good.
02-04-2023