bug-classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug classpath/23890] New: GregorianCalendar.equals() doesn't account fo


From: green at redhat dot com
Subject: [Bug classpath/23890] New: GregorianCalendar.equals() doesn't account for change-over date differences
Date: 14 Sep 2005 22:41:30 -0000

The following code should print:
true
false

It currently prints:
true
true


import java.util.*;

public class GregorianTest
{
    public static void main (String args[])
    {
        GregorianCalendar gc1 = new GregorianCalendar ();
        GregorianCalendar gc2 = new GregorianCalendar ();

        System.out.println (gc1.equals (gc2));

        gc2.setGregorianChange (new Date (Long.MAX_VALUE));

        System.out.println (gc1.equals (gc2));
    }
}

The library spec does not specifically say how to decide whether or not two of
these things are equal.  However, experiments with Sun's implementation tell us
that the change date is part of the comparison.

The Mauve test gnu.testlet.java.util.GregorianCalendar.equals also tests for 
this.  

Note that GregorianCalendar will need a special hashCode() implementation when
this is fixed!

-- 
           Summary: GregorianCalendar.equals() doesn't account for change-
                    over date differences
           Product: classpath
           Version: unspecified
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: classpath
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: green at redhat dot com
                CC: bug-classpath at gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23890




reply via email to

[Prev in Thread] Current Thread [Next in Thread]