harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From py...@apache.org
Subject svn commit: r430283 - in /incubator/harmony/enhanced/classlib/trunk/modules/luni/src: main/java/java/util/Collections.java test/api/java/org/apache/harmony/luni/tests/java/util/CollectionsTest.java
Date Thu, 10 Aug 2006 06:36:16 GMT
Author: pyang
Date: Wed Aug  9 23:36:15 2006
New Revision: 430283

URL: http://svn.apache.org/viewvc?rev=430283&view=rev
Log:
Patch applied for HARMONY-1102 ([classlib][luni] Method readResolve() missing in java.util.Collections.EmptySet,
EmptyList and EmptyMap)

Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Collections.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/api/java/org/apache/harmony/luni/tests/java/util/CollectionsTest.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Collections.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Collections.java?rev=430283&r1=430282&r2=430283&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Collections.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Collections.java
Wed Aug  9 23:36:15 2006
@@ -1,4 +1,4 @@
-/* Copyright 1998, 2005 The Apache Software Foundation or its licensors, as applicable
+/* Copyright 1998, 2006 The Apache Software Foundation or its licensors, as applicable
  * 
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -74,6 +74,10 @@
 		public Object get(int location) {
 			throw new IndexOutOfBoundsException();
 		}
+        
+        private Object readResolve() {
+            return Collections.EMPTY_LIST;
+        }
 	}
 
 	@SuppressWarnings("unchecked")
@@ -104,6 +108,10 @@
 				}
 			};
 		}
+        
+        private Object readResolve() {
+            return Collections.EMPTY_SET;
+        }
 	}
 
 	@SuppressWarnings("unchecked")
@@ -134,6 +142,10 @@
 		public Collection values() {
 			return EMPTY_LIST;
 		}
+        
+        private Object readResolve() {
+            return Collections.EMPTY_MAP;
+        }
 	}
 
     @SuppressWarnings("unchecked")

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/api/java/org/apache/harmony/luni/tests/java/util/CollectionsTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/api/java/org/apache/harmony/luni/tests/java/util/CollectionsTest.java?rev=430283&r1=430282&r2=430283&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/api/java/org/apache/harmony/luni/tests/java/util/CollectionsTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/api/java/org/apache/harmony/luni/tests/java/util/CollectionsTest.java
Wed Aug  9 23:36:15 2006
@@ -35,11 +35,20 @@
 import java.util.TreeSet;
 import java.util.Vector;
 
+import org.apache.harmony.testframework.serialization.SerializationTest;
+import org.apache.harmony.testframework.serialization.SerializationTest.SerializableAssert;
+
 import junit.framework.TestCase;
 import tests.util.SerializationTester;
 
 public class CollectionsTest extends TestCase {
 
+    private static final SerializableAssert comparator = new SerializableAssert() {
+        public void assertDeserialized(Serializable reference, Serializable test) {
+            assertSame(reference, test);
+        }
+    };
+    
 	/**
 	 * @tests java.util.Collections#binarySearch(java.util.List,
 	 *        java.lang.Object, java.util.Comparator)
@@ -361,6 +370,27 @@
         c1.add(arr2[10]);
         assertFalse(Collections.disjoint(c1, c2));
 
+    }
+    
+    /**
+     * @tests java.util.Collections.EmptyList#readResolve()
+     */
+    public void test_EmptyList_readResolve() throws Exception {
+        SerializationTest.verifySelf(Collections.EMPTY_LIST, comparator);
+    }
+
+    /**
+     * @tests java.util.Collections.EmptyMap#readResolve()
+     */
+    public void test_EmptyMap_readResolve() throws Exception {
+        SerializationTest.verifySelf(Collections.EMPTY_MAP, comparator);
+    }
+
+    /**
+     * @tests java.util.Collections.EmptySet#readResolve()
+     */
+    public void test_EmptySet_readResolve() throws Exception {
+        SerializationTest.verifySelf(Collections.EMPTY_SET, comparator);
     }
     
     public void test_checkedCollectionSerializationCompatability() throws Exception {



Mime
View raw message