JDK-6191841 : (cal) API: Calendar.roll spec should clarify DAY_OF_WEEK behavior
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.util:i18n
  • Affected Version: 5.0
  • Priority: P4
  • Status: Closed
  • Resolution: Future Project
  • OS: generic
  • CPU: generic
  • Submitted: 2004-11-06
  • Updated: 2021-05-25
  • Resolved: 2009-06-10
Related Reports
Relates :  
Relates :  
Description
The roll spec in the Calendar class has the following rule:

Roll rule. Larger fields are unchanged after the call. A larger field represents a larger unit of time. DAY_OF_MONTH is a larger field than HOUR.

However, the roll implementation in the GregorianCalendar class changes the larger fields when the DAY_OF_WEEK field is specified. That is, the ERA, YEAR and MONTH fields should not be changed by rolling with the DAY_OF_WEEK field. But it's too late to change the roll behavior.

The roll rule should be change to be consistent with the DAY_OF_WEEK roll implementation.
###@###.### 2004-11-06 01:50:51 GMT

Comments
EVALUATION This problem exists since 1999. ###@###.### 2004-11-06 01:56:14 GMT Similar fixes are required for other fields to support the Japanese imperial year numbering. For example, rolling DAY_OF_MONTH in a transition month (e.g., 1989 January) may change ERA and YEAR. It may be rather inconvenient if DAY_OF_MONTH rolls between Jan 1 and Jan 7 in Showa 64 January and between Jan 8 and Jan 31 in Heisei 1 Jan. ###@###.### 2005-03-16 05:40:16 GMT
06-11-2004