harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From smish...@apache.org
Subject svn commit: r399153 - in /incubator/harmony/enhanced/classlib/trunk/modules: luni/src/main/java/java/util/ luni/src/test/java/tests/api/java/util/ sql/src/main/java/java/sql/ sql/src/test/java/org/apache/harmony/sql/tests/java/sql/
Date Wed, 03 May 2006 05:48:39 GMT
Author: smishura
Date: Tue May  2 22:48:36 2006
New Revision: 399153

URL: http://svn.apache.org/viewcvs?rev=399153&view=rev
Log:
Apply patch for HARMONY-427 ([classlib][luni] java.util.Date Comparable<Date>) + corresponding
update for SQL module.

Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Date.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/DateTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/java/sql/Date.java
    incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/java/sql/Time.java
    incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/java/sql/Timestamp.java
    incubator/harmony/enhanced/classlib/trunk/modules/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/TimestampTest.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Date.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Date.java?rev=399153&r1=399152&r2=399153&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Date.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Date.java
Tue May  2 22:48:36 2006
@@ -33,7 +33,7 @@
  * @see SimpleTimeZone
  * @see TimeZone
  */
-public class Date implements Serializable, Cloneable, Comparable {
+public class Date implements Serializable, Cloneable, Comparable<Date> {
 	
 	private static final long serialVersionUID = 7523967970034938905L;
 
@@ -178,22 +178,6 @@
 		} catch (CloneNotSupportedException e) {
 			return null;
 		}
-	}
-
-	/**
-	 * Compare the receiver to the specified Object to determine the relative
-	 * ordering.
-	 * 
-	 * @param object
-	 *            an Object
-	 * @return an int < 0 if this Date is less than the specified Date, 0 if
-	 *         they are equal, and > 0 if this Date is greater
-	 * 
-	 * @exception ClassCastException
-	 *                when object is not a Date
-	 */
-	public int compareTo(Object object) {
-		return compareTo((Date) object);
 	}
 
 	/**

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/DateTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/DateTest.java?rev=399153&r1=399152&r2=399153&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/DateTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/DateTest.java
Tue May  2 22:48:36 2006
@@ -147,34 +147,6 @@
 	}
 
 	/**
-	 * @tests java.util.Date#compareTo(java.lang.Object)
-	 */
-	public void test_compareToLjava_lang_Object() {
-		// Test for method int java.util.Date.compareTo(java.lang.Object)
-		final int someNumber = 10000;
-		Date d1 = new Date(someNumber);
-		Date d2 = new Date(someNumber);
-		Date d3 = new Date(someNumber + 1);
-		Date d4 = new Date(someNumber - 1);
-		Integer i = new Integer(0);
-		assertEquals("Comparing a date to itself did not answer zero", 0, d1
-				.compareTo((Object) d1));
-		assertEquals("Comparing equal dates did not answer zero", 0, d1
-				.compareTo((Object) d2));
-		assertEquals("date1.compareTo(date2), where date1 > date2, did not result in 1",
-				1, d1.compareTo((Object) d4));
-		assertEquals("date1.compareTo(date2), where date1 < date2, did not result in -1",
-				-1, d1.compareTo((Object) d3));
-		try {
-			d1.compareTo(i);
-		} catch (ClassCastException e) {
-			return;
-		}
-		fail(
-				"Comparing a date to a non-date did not throw ClassCastException");
-	}
-
-	/**
 	 * @tests java.util.Date#compareTo(java.util.Date)
 	 */
 	public void test_compareToLjava_util_Date() {

Modified: incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/java/sql/Date.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/java/sql/Date.java?rev=399153&r1=399152&r2=399153&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/java/sql/Date.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/java/sql/Date.java
Tue May  2 22:48:36 2006
@@ -34,7 +34,7 @@
  * 00:00:00.000 GMT.  Time values passed to the java.sql.Date class are "normalised" to the
time 
  * 00:00:00.000 GMT on the date implied by the time value.
  */
-public class Date extends java.util.Date implements Serializable, Cloneable, Comparable {
+public class Date extends java.util.Date {
 
 	private static final long serialVersionUID = 1511598038487230103L;
 	

Modified: incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/java/sql/Time.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/java/sql/Time.java?rev=399153&r1=399152&r2=399153&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/java/sql/Time.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/java/sql/Time.java
Tue May  2 22:48:36 2006
@@ -26,7 +26,7 @@
  * interpretation of JDBC escape format for time values.
  * 
  */
-public class Time extends Date implements Serializable, Cloneable, Comparable {
+public class Time extends Date {
 	
 	private static final long serialVersionUID = 8397324403548013681L;
 

Modified: incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/java/sql/Timestamp.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/java/sql/Timestamp.java?rev=399153&r1=399152&r2=399153&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/java/sql/Timestamp.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/java/sql/Timestamp.java
Tue May  2 22:48:36 2006
@@ -37,7 +37,7 @@
  * java.util.Date objects when used outside the confines of the java.sql package.  
  * 
  */
-public class Timestamp extends Date implements Serializable, Cloneable, Comparable {
+public class Timestamp extends Date {
 	
 	private static final long serialVersionUID = 2745179027874758501L;
 	
@@ -132,7 +132,7 @@
 	 * Timestamp
 	 * @throws ClassCastException if the supplied object is not a Timestamp object
 	 */
-	public int	compareTo( Object theObject ) throws ClassCastException {
+	public int compareTo( Date theObject ) throws ClassCastException {
 		return this.compareTo( (Timestamp) theObject );
 	} // end method compareTo( Object )
     

Modified: incubator/harmony/enhanced/classlib/trunk/modules/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/TimestampTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/TimestampTest.java?rev=399153&r1=399152&r2=399153&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/TimestampTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/TimestampTest.java
Tue May  2 22:48:36 2006
@@ -16,6 +16,7 @@
 package org.apache.harmony.sql.tests.java.sql;
 
 import java.sql.Timestamp;
+import java.util.Date;
 import java.util.TimeZone;
 
 import junit.framework.TestCase;
@@ -561,23 +562,23 @@
 
 	} // end method testcompareToTimestamp
 
-	/*
-	 * Method test for compareTo
+	/**
+	 * @tests java.sql.Timestamp#compareTo(java.util.Date)
 	 */
-	public void testCompareToObject() {
-		Object theTest = new Timestamp(TIME_EARLY);
-		Object theTest2 = new Timestamp(TIME_LATE);
+	public void testCompareToDate() {
+		Date theTest = new Timestamp(TIME_EARLY);
+		Date theTest2 = new Timestamp(TIME_LATE);
 
 		for (int i = 0; i < TIME_ARRAY.length; i++) {
 			Timestamp theTimestamp = new Timestamp(TIME_ARRAY[i]);
-			Object theTimestamp2 = new Timestamp(TIME_ARRAY[i]);
+			Date theTimestamp2 = new Timestamp(TIME_ARRAY[i]);
 
 			assertTrue(theTimestamp.compareTo(theTest) > 0);
 			assertTrue(theTimestamp.compareTo(theTest2) < 0);
 			assertEquals(0, theTimestamp.compareTo(theTimestamp2));
 		} // end for
 
-		Object nastyTest = new String("Test ");
+		Date nastyTest = new Date();
 		Timestamp theTimestamp = new Timestamp(TIME_ARRAY[1]);
 		try {
 			theTimestamp.compareTo(nastyTest);



Mime
View raw message