JDK-4028908 : clone() in java.util.Calendar aliases internal arrays causing all clones to be c
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.util
  • Affected Version: 1.1
  • Priority: P3
  • Status: Closed
  • Resolution: Cannot Reproduce
  • OS: windows_nt
  • CPU: x86
  • Submitted: 1997-01-30
  • Updated: 1997-07-15
  • Resolved: 1997-07-15
Related Reports
Relates :  
Description

Name: mc57594			Date: 01/29/97


java.util.Calendar has two array members called fields and isSet.  
The clone() method simply calls super.clone(), and does not copy the arrays.  
This causes the arrays to be aliased.  Ergo, all clones shared the same instances 
as their progenitor, and are therefore corrupt.  GregorianCalendar inherits this bug.
======================================================================

Comments
EVALUATION The complaint is no longer true for JDK 1.1 and up. It looks like somebody fixed this on the way...
11-06-2004

WORK AROUND Name: mc57594 Date: 01/29/97 copies of Calendar-derived objects must be manually assembled. ======================================================================
11-06-2004