harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From qi...@apache.org
Subject svn commit: r742850 - in /harmony/enhanced/classlib/trunk/modules/luni/src: main/java/java/util/Arrays.java test/api/common/org/apache/harmony/luni/tests/java/util/ArraysTest.java
Date Tue, 10 Feb 2009 04:58:23 GMT
Author: qiuxx
Date: Tue Feb 10 04:58:20 2009
New Revision: 742850

URL: http://svn.apache.org/viewvc?rev=742850&view=rev
Log:
Revert patch at r680223, the testcase is not proper, and this patch will cause new issue described
at HARMONY-6076([eut][classlib][luni] - Arrays.sort(T[] a, Comparator<? super T> c)
 is not stable)

Modified:
    harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Arrays.java
    harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/ArraysTest.java

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Arrays.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Arrays.java?rev=742850&r1=742849&r2=742850&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Arrays.java (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Arrays.java Tue Feb
10 04:58:20 2009
@@ -2520,7 +2520,7 @@
             Object fromVal = in[start];
             Object rVal = in[r];
             if (c.compare(fromVal, rVal) <= 0) {
-                int l_1 = find(in, rVal, 0, start + 1, med - 1, c);
+                int l_1 = find(in, rVal, -1, start + 1, med - 1, c);
                 int toCopy = l_1 - start + 1;
                 System.arraycopy(in, start, out, i, toCopy);
                 i += toCopy;

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/ArraysTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/ArraysTest.java?rev=742850&r1=742849&r2=742850&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/ArraysTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/ArraysTest.java
Tue Feb 10 04:58:20 2009
@@ -1296,8 +1296,7 @@
 	/**
 	 * @tests java.util.Arrays#sort(java.lang.Object[], java.util.Comparator)
 	 */
-    @SuppressWarnings("unchecked")
-    public void test_sort$Ljava_lang_ObjectLjava_util_Comparator() {
+	public void test_sort$Ljava_lang_ObjectLjava_util_Comparator() {
 		// Test for method void java.util.Arrays.sort(java.lang.Object [],
 		// java.util.Comparator)
 		ReversedIntegerComparator comp = new ReversedIntegerComparator();
@@ -1307,52 +1306,6 @@
 					comp
 							.compare(objectArray[counter],
 									objectArray[counter + 1]) <= 0);
-        
-        // Test the sort functionailty with an Integer array
-        int[] original = { 190, 180, 170, 160, 150, 140, 120, 320, 110, 310,
-                100, 300, 290, 280, 270, 260, 250, 240, 230, 210, 200 };
-        Integer[] sorted = { 100, 110, 120, 140, 150, 160, 170, 180, 190, 200,
-                210, 230, 240, 250, 260, 270, 280, 290, 300, 310, 320 };
-
-        Integer[] elements = new Integer[original.length];
-        for (int i=0; i < original.length; i++){
-            elements[i] = new Integer(original[i]);
-        }
-        
-        Comparator normalComparator = new Comparator(){
-            public int compare(Object o1, Object o2) {
-                Integer e1 = (Integer)o1;
-                Integer e2 = (Integer)o2;
-                if (e1 > e2){
-                    return 1;
-                }else if(e1 < e2){
-                    return -1;
-                }else{
-                    return 0;
-                }
-            }
-        };
-        Arrays.sort(elements, normalComparator);
-        // After sorting, elements should be the same as sorted array.
-        for(int i = 0; i < original.length; i++){
-            assertEquals(sorted[i],elements[i]);
-        }
-
-        for (int i=0; i < original.length; i++){
-            elements[i] = new Integer(original[i]);
-        }
-        Comparator comparator = new Comparator(){
-            public int compare(Object o1, Object o2) {
-                Integer e1 = (Integer)o1;
-                Integer e2 = (Integer)o2;
-                return e1 > e2 ? 1 : 0;
-            }
-        };
-        Arrays.sort(elements, comparator);
-        // After sorting, elements should be the same as sorted array.
-        for(int i = 0; i < original.length; i++){
-            assertEquals(sorted[i],elements[i]);
-        }
 	}
 
 	/**



Mime
View raw message