diff options
Diffstat (limited to 'libjava/classpath/java/util/GregorianCalendar.java')
-rw-r--r-- | libjava/classpath/java/util/GregorianCalendar.java | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/libjava/classpath/java/util/GregorianCalendar.java b/libjava/classpath/java/util/GregorianCalendar.java index b086a7d04a4..89b7c4dbd02 100644 --- a/libjava/classpath/java/util/GregorianCalendar.java +++ b/libjava/classpath/java/util/GregorianCalendar.java @@ -868,6 +868,17 @@ public class GregorianCalendar extends Calendar areFieldsSet = isSet[ERA] = isSet[YEAR] = isSet[MONTH] = isSet[WEEK_OF_YEAR] = isSet[WEEK_OF_MONTH] = isSet[DAY_OF_MONTH] = isSet[DAY_OF_YEAR] = isSet[DAY_OF_WEEK] = isSet[DAY_OF_WEEK_IN_MONTH] = isSet[AM_PM] = isSet[HOUR] = isSet[HOUR_OF_DAY] = isSet[MINUTE] = isSet[SECOND] = isSet[MILLISECOND] = isSet[ZONE_OFFSET] = isSet[DST_OFFSET] = true; } + + /** + * Return a hash code for this object, following the general contract + * specified by {@link Object#hashCode()}. + * @return the hash code + */ + public int hashCode() + { + int val = (int) ((gregorianCutover >>> 32) ^ (gregorianCutover & 0xffffffff)); + return super.hashCode() ^ val; + } /** * Compares the given calendar with this. An object, o, is @@ -890,7 +901,8 @@ public class GregorianCalendar extends Calendar return false; GregorianCalendar cal = (GregorianCalendar) o; - return (cal.getTimeInMillis() == getTimeInMillis()); + return (cal.gregorianCutover == gregorianCutover + && super.equals(o)); } /** |