JDK-6348938 : (cal) Need Read-access to the stamp data member of the Calendar class
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.util:i18n
  • Affected Version: 5.0
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2005-11-11
  • Updated: 2010-07-29
  • Resolved: 2005-11-11
Related Reports
Duplicate :  
Description
FULL PRODUCT VERSION :
java version "1.5.0_05"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_05-b05)
Java HotSpot(TM) Client VM (build 1.5.0_05-b05, mixed mode, sharing)

ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]

A DESCRIPTION OF THE PROBLEM :
  To take full advantage of the code in Calendar, a concrete sub-class needs read-access to Calendar's stamp field.   This access is required by a sub-class
in order to determine which field amongst competing fields (e.g
HOUR/AM_PM vs. HOUR_OF_DAY) to use in computeTime ().

Calendar should provide a new protected method [e.g. getStamp (int field)] for examining the value of the stamp.

This problem has existed since (at least) JDK 1.3.1.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Not Applicable.

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Ability to derive a Calendar sub class without reimplementing most of Calendar's logic.
ACTUAL -
Inability to derive a concrete class from Calendar without reimplementing most of its logic.

REPRODUCIBILITY :
This bug can be reproduced always.

CUSTOMER SUBMITTED WORKAROUND :
Maintaining local version of Calendar with getStamp () method.

Comments
EVALUATION Calendar subclassing is broken since 1.2 due to the stamp[] introduction. Closing this one as a duplicate of 4209296.
11-11-2005