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

Declare a public field in JapaneseEra for the era starting May 2019

    XMLWordPrintable

Details

    • CSR
    • Resolution: Approved
    • P2
    • 13
    • core-libs
    • None
    • minimal
    • Java API
    • SE

    Description

      Summary

      Declare a public field in java.time.chrono.JapaneseEra for the new era which starts May 1st, 2019.

      Problem

      Without a field, developers have to call JapaneseEra.of(int) with the value 3 in order to obtain an instance of JapaneseEra that represents the new era; this is not intuitive.

      Solution

      Declare a public static final field that represents the new era, mirroring the pre-existing fields such as JapaneseEra.HEISEI.

      Specification

      Add a new era field in java.time.chrono.JapaneseEra:

      /**
       * The singleton instance for the 'Reiwa' era (2019-05-01 - )
       * which has the value 3. The end date of this era is not specified, unless
       * the Japanese Government defines it.
       */
      public static final JapaneseEra REIWA;

      Change the specification of the method java.time.chrono.JapaneseChronology#eraOf(int) from:

      /**
       * Returns the calendar system era object from the given numeric value.
       *
       * See the description of each Era for the numeric values of:
       * {@link JapaneseEra#HEISEI},{@link JapaneseEra#SHOWA},{@link JapaneseEra#TAISHO},
       * {@link JapaneseEra#MEIJI}), only Meiji and later eras are supported.
       * ...

      to:

      /**
       * Returns the calendar system era object from the given numeric value.
       * The numeric values supported by this method are the same as the
       * numeric values supported by {@link JapaneseEra#of(int)}.
       * ...

      Also, add the following row in "japanese"/Calendar.ERA section of java.util.spi.CalendarNameProvider's chart in its class description:

      <tr>
        <th scope="row" style="font-weight:normal">5</th>
        <td >Reiwa</td>
      </tr>   

      Link to the specdiff: http://cr.openjdk.java.net/~naoto/8174268/specdiff.00/overview-summary.html

      Attachments

        Issue Links

          Activity

            People

              naoto Naoto Sato
              naoto Naoto Sato
              Alex Buckley, Chris Hegarty
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: