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

Add a singleton instance in JapaneseEra class for the new era

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Withdrawn
    • Icon: P2 P2
    • 11-pool
    • core-libs
    • None
    • behavioral
    • minimal
    • Java API

      Summary

      Add a singleton instance in java.time.chrono.JapaneseEra that represents the new era starting from May 1st, 2019.

      Problem

      Users have to specify an integer value 5 in of(int) method of java.time.chrono.JapaneseEra to obtain the new era instance. Currently access modifier for static singleton instance of NEWERA is private due to users can not access it directly.

      Solution

      Change the access modified of static singleton instance NEWERA from private to public which was added as part of JDK-8202088.

      As per CSR JDK-8215946, java.time.chrono.JapaneseEra spec is loosen for era range so that once an era is defined subsequent versions of this class will add a singleton instance. Therefore, access modified of NEWERA can be changed to public.

      Please refer below email thread talks about MR for 11u release:-

      http://mail.openjdk.java.net/pipermail/jdk-updates-dev/2018-December/000308.html

      Specification

      Change-1

      Change access modifier of singleton of NewEra from private to public in java.time.chrono.JapaneseEra class.

      Below is the section of hg diff:

       -    private static final JapaneseEra NEWERA = new JapaneseEra(3, LocalDate.of(2019, 5, 1));
       +    public static final JapaneseEra NEWERA = new JapaneseEra(3, LocalDate.of(2019, 5, 1));

      Change-2

      Change the second paragraph of of(int) method description in java.time.chrono.JapaneseEra class to include NEWERA.

      Below is the section of hg diff:

      -     * The {@link #SHOWA} era that contains 1970-01-01 (ISO calendar system) has the value 1.
      -     * Later era is numbered 2 ({@link #HEISEI}). Earlier eras are numbered 0 ({@link #TAISHO}),
      -     * -1 ({@link #MEIJI}), only Meiji and later eras are supported.
      +     * The {@link #SHOWA} era that contains 1970-01-01 (ISO calendar system) has the value 1
      +     * Later era is numbered 2 ({@link #HEISEI}), 3 ({@link #NEWERA}). Earlier eras are,
      +     * numbered 0 ({@link #TAISHO}) -1 ({@link #MEIJI}), only Meiji and later eras are
      +     * supported.

      Change-3

      Change the second paragraph of getValue() method description in java.time.chrono.JapaneseEra class to include NEWERA.

      Below is the section of hg diff:

            * The {@link #SHOWA} era that contains 1970-01-01 (ISO calendar system) has the value 1.
      -     * Later eras are numbered from 2 ({@link #HEISEI}).
      +    * Later eras are numbered from 2 ({@link #HEISEI}), 3 ({@link #NEWERA}).
           * Earlier eras are numbered 0 ({@link #TAISHO}), -1 ({@link #MEIJI})).

      Change-4

      Change the second paragraph of eraOf(int) method description in java.time.chrono.JapaneseChronology class to include NEWERA.

      Below is the section of hg diff:

      -     * {@link JapaneseEra#HEISEI}, {@link JapaneseEra#SHOWA},{@link JapaneseEra#TAISHO},
      +     * {@link JapaneseEra#NEWERA}, {@link JapaneseEra#HEISEI},
      +     * {@link JapaneseEra#SHOWA},{@link JapaneseEra#TAISHO},

      Change-5

      Change japanese/Calendar.ERA section of java.util.spi.CalendarNameProvider class to add a row for NEWERA.

      Below is the section of hg diff:

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

            dkejriwal Deepak Kejriwal (Inactive)
            naoto Naoto Sato
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: