Summary
In order to accommodate the future addition of JapaneseEra without spec changes, loosening the current JapaneseEra spec would be desired.
Problem
The current spec does not mention available eras returned from of()/valueOf()/values() methods, especially it is unclear if a new era is declared by the Japanese government. This would be more problematic for the maintenance releases.
Solution
Specify the possible values returned from those static methods, and their parameters.
Specification
Add the following sentence in the class description:
* The number of the valid eras may increase, as new eras may be
* defined by the Japanese government. Once an era is defined,
* subsequent versions of this class will add a singleton instance
* for it. The defined era is expected to have a consecutive integer
* associated with it.
Add the following paragraph to of(int) method description:
* <p>
* In addition to the known era singletons, values for additional
* eras may be defined. Those values are the {@link Era#getValue()}
* of corresponding eras from the {@link #values()} method.
Add the following paragraph to valueOf(String) method description:
* <p>
* Valid era names are the names of eras returned from {@link #values()}.
Change the first paragraph of values() method from:
* Returns an array of JapaneseEras.
to:
* Returns an array of JapaneseEras. The array may contain eras defined
* by the Japanese government beyond the known era singletons.
- csr of
-
JDK-8212941 Support new Japanese era in java.time.chrono.JapaneseEra
- Resolved
- relates to
-
JDK-8215946 Support new Japanese era in java.time.chrono.JapaneseEra
- Closed