Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8202336

Japanese new era implementation

    Details

    • Type: CSR
    • Status: Closed
    • Priority: P3
    • Resolution: Approved
    • Fix Version/s: 11
    • Component/s: core-libs
    • Labels:
      None
    • Subcomponent:
    • Compatibility Kind:
      behavioral
    • Compatibility Risk:
      low
    • Compatibility Risk Description:
      Hide
      After the real era name is known and replaces this placeholder, format/parse will not work with the placeholder objects. I.e., the placeholder era name "NewEra" will not be parsed when it is replaced. Thus users should not depend on the name "NewEra", e.g., getting the era with JapaneseEra.valueOf("NewEra"). Use JapaneseEra.of(3) instead.
      Show
      After the real era name is known and replaces this placeholder, format/parse will not work with the placeholder objects. I.e., the placeholder era name "NewEra" will not be parsed when it is replaced. Thus users should not depend on the name "NewEra", e.g., getting the era with JapaneseEra.valueOf("NewEra"). Use JapaneseEra.of(3) instead.
    • Interface Kind:
      Java API
    • Scope:
      SE

      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"

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                naoto Naoto Sato
                Reporter:
                naoto Naoto Sato
                Reviewed By:
                Stuart Marks
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: