harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From py...@apache.org
Subject svn commit: r538068 - in /harmony/enhanced/classlib/trunk/modules/luni/src: main/java/java/util/AbstractSequentialList.java test/java/tests/api/java/util/AbstractSequentialListTest.java
Date Tue, 15 May 2007 06:23:35 GMT
Author: pyang
Date: Mon May 14 23:23:34 2007
New Revision: 538068

URL: http://svn.apache.org/viewvc?view=rev&rev=538068
Log:
Apply patch for HARMONY=-3863([classlib][luni] AbstractSequentialList addAll(location,Collection)
is incorrect. Adds collection reversed and returns false.)

Added:
    harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/AbstractSequentialListTest.java
Modified:
    harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/AbstractSequentialList.java

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/AbstractSequentialList.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/AbstractSequentialList.java?view=diff&rev=538068&r1=538067&r2=538068
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/AbstractSequentialList.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/AbstractSequentialList.java
Mon May 14 23:23:34 2007
@@ -89,7 +89,6 @@
 		int next = it.nextIndex();
 		while (colIt.hasNext()) {
 			it.add(colIt.next());
-			it.previous();
 		}
 		return next != it.nextIndex();
 	}

Added: harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/AbstractSequentialListTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/AbstractSequentialListTest.java?view=auto&rev=538068
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/AbstractSequentialListTest.java
(added)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/AbstractSequentialListTest.java
Mon May 14 23:23:34 2007
@@ -0,0 +1,68 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package tests.api.java.util;
+
+import java.util.AbstractSequentialList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.LinkedList;
+import java.util.ListIterator;
+
+import junit.framework.TestCase;
+
+public class AbstractSequentialListTest extends TestCase {
+
+    @Override
+    protected void setUp() throws Exception {
+        super.setUp();
+    }
+
+    @Override
+    protected void tearDown() throws Exception {
+        super.tearDown();
+    }
+    
+    class ASLT<E> extends AbstractSequentialList<E> {
+
+        LinkedList<E> l = new LinkedList<E>();
+
+        @Override
+        public ListIterator<E> listIterator(int index) {
+            return l.listIterator(index);
+        }
+
+        @Override
+        public int size() {
+            return l.size();
+        }
+    }
+    
+    /**
+     * @tests {@link java.util.AbstractSequentialList#addAll(int, java.util.Collection)}
+     */
+    public void test_addAll_ILCollection() {
+        AbstractSequentialList<String> al = new ASLT<String>();
+        String[] someList = { "Aardvark",  //$NON-NLS-1$
+                "Bear",  //$NON-NLS-1$
+                "Chimpanzee",  //$NON-NLS-1$
+                "Duck" }; //$NON-NLS-1$
+        Collection<String> c = Arrays.asList(someList);
+        al.addAll(c);
+        assertTrue("Should return true", al.addAll(2, c)); //$NON-NLS-1$
+    }
+
+}



Mime
View raw message