JDK-8193826 : Declare a public field in JapaneseEra for the era starting May 2019
  • Type: CSR
  • Component: core-libs
  • Sub-Component: java.util:i18n
  • Priority: P2
  • Status: Closed
  • Resolution: Approved
  • Fix Versions: 13
  • Submitted: 2017-12-19
  • Updated: 2019-04-03
  • Resolved: 2019-04-01
Related Reports
CSR :  

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


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.


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


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.
     * ...


     * 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:

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

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

Moving to Provisional.