JDK-8202336 : Japanese new era implementation
  • Type: CSR
  • Component: core-libs
  • Sub-Component: java.util:i18n
  • Priority: P3
  • Status: Closed
  • Resolution: Approved
  • Fix Versions: 11
  • Submitted: 2018-04-26
  • Updated: 2018-06-08
  • Resolved: 2018-06-07
Related Reports
CSR :  
Description
Summary
-------

It is imperative to have the Japanese new era implemented in the JDK prior to its start date (May 1st, 2019).

Problem
-------

It is anticipated that the announcement of the name of the new era may not be ready for the last JDK update before the beginning of the new era.

Solution
--------

Implement the new era with a placeholder name "NewEra" (default) and ��������� (in Japanese), so that the "year of era" value should be correctly calculated. The placeholder should be replaced with the genuine name after it is announced (with JDK-8174268)

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

**java.time.chrono.JapaneseEra:**

The field description of HEISEI changes from:

    The singleton instance for the 'Heisei' era (1989-01-08 - current)

to:
    
    The singleton instance for the 'Heisei' era (1989-01-08 - 2019-04-30)

"NewEra" singleton, which starts from 2019-05-01 and has the value of '3', will be defined in JapaneseEra class and be used:

- values() method will return 5 eras: [Meiji, Taisho, Showa, Heisei, NewEra]
- JapaneseEra.of(3) will return a singleton era that represents "NewEra"

**java.util.Calendar:**

JapaneseImperialCalendar will have the new era that has the value of '5'. Thus,

    new Calendar.Builder()
        .setCalendarType("japanese")
        .setFields(Calendar.ERA, 5,
            Calendar.YEAR, 1,
            Calendar.MONTH, Calendar.MAY,
            Calendar.DAY_OF_MONTH, 1)
        .build()
        .getDisplayName(Calendar.ERA, Calendar.LONG, Locale.US)

returns "NewEra"
Comments
I would prefer a different name, but I'm voting to approve the request. Are there any plans for an analogous change to JDK 8u?
07-06-2018

The issue for more descriptive era is that, it would end up a longer name in Japanese, which may look odd because each existing era consists of two characters. "NewEra" would end up in three chars, but that is acceptable IMO.
29-05-2018

Agree that not having a named constant for the "new era" is strongly preferred. Unless there is a conventional term for the post-Heisei era, I'd prefer something like "POST-HEISEI" to "new era" since it is more descriptive.
29-05-2018

What I meant to express here is that there will be a singleton instance for the new era, but accessible through an integer value (either 3 in java.time or 5 in java.util. valueOf("NewEra") is discouraged). Public constant to designate the singleton instance will be defined later, as you mentioned.
22-05-2018

In the implementation webrev, there is no public symbol for the new Era. That's good, but the CSR should not say there is a new singleton. Alternatively, it could say the public singleton will be added in a future chaneg when the name is known.
22-05-2018

It seems problematic to define "NEWERA" and then expect to be able to replace it. The placeholder should be spelled such that is specific to the May 1, 2019 change.
18-05-2018