You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by hi...@apache.org on 2010/10/27 15:42:29 UTC

svn commit: r1027958 - in /harmony/enhanced/java/branches/java6: ./ classlib/ classlib/depends/libs/ classlib/modules/beans/main/ classlib/modules/beans/main/java/ classlib/modules/beans/main/java/java/ classlib/modules/beans/main/java/java/beans/ clas...

Author: hindessm
Date: Wed Oct 27 13:42:28 2010
New Revision: 1027958

URL: http://svn.apache.org/viewvc?rev=1027958&view=rev
Log:
Merge change from /harmony/enhanced/java/trunk@1022963:

  r1022963 | zhoukevin | 2010-10-15 16:17:01 +0100 (Fri, 15 Oct 2010) | 2 lines

  For objects of types generated by methods of java.util.Collections class,
  like java.util.Collections$UnmodifiableCollection generated by
  java.util.Collections.unmodifiableCollection(Collection) method etc,
  HARMONY has problem to encode and decode them while Oracle JDK doesn't.
  This patch also adds several test cases to reproduce those problems.

Added:
    harmony/enhanced/java/branches/java6/classlib/modules/beans/main/
      - copied from r1022963, harmony/enhanced/java/trunk/classlib/modules/beans/main/
    harmony/enhanced/java/branches/java6/classlib/modules/beans/main/java/
      - copied from r1022963, harmony/enhanced/java/trunk/classlib/modules/beans/main/java/
    harmony/enhanced/java/branches/java6/classlib/modules/beans/main/java/java/
      - copied from r1022963, harmony/enhanced/java/trunk/classlib/modules/beans/main/java/java/
    harmony/enhanced/java/branches/java6/classlib/modules/beans/main/java/java/beans/
      - copied from r1022963, harmony/enhanced/java/trunk/classlib/modules/beans/main/java/java/beans/
    harmony/enhanced/java/branches/java6/classlib/modules/beans/main/java/java/beans/UtilCollectionsPersistenceDelegate.java
      - copied unchanged from r1022963, harmony/enhanced/java/trunk/classlib/modules/beans/main/java/java/beans/UtilCollectionsPersistenceDelegate.java
    harmony/enhanced/java/branches/java6/classlib/modules/beans/src/main/java/java/beans/UtilCollectionsPersistenceDelegate.java
      - copied unchanged from r1022963, harmony/enhanced/java/trunk/classlib/modules/beans/src/main/java/java/beans/UtilCollectionsPersistenceDelegate.java
    harmony/enhanced/java/branches/java6/classlib/modules/beans/src/test/resources/xml/MockCheckedCollection.xml
      - copied unchanged from r1022963, harmony/enhanced/java/trunk/classlib/modules/beans/src/test/resources/xml/MockCheckedCollection.xml
    harmony/enhanced/java/branches/java6/classlib/modules/beans/src/test/resources/xml/MockCheckedList.xml
      - copied unchanged from r1022963, harmony/enhanced/java/trunk/classlib/modules/beans/src/test/resources/xml/MockCheckedList.xml
    harmony/enhanced/java/branches/java6/classlib/modules/beans/src/test/resources/xml/MockCheckedMap.xml
      - copied unchanged from r1022963, harmony/enhanced/java/trunk/classlib/modules/beans/src/test/resources/xml/MockCheckedMap.xml
    harmony/enhanced/java/branches/java6/classlib/modules/beans/src/test/resources/xml/MockCheckedRandomAccessList.xml
      - copied unchanged from r1022963, harmony/enhanced/java/trunk/classlib/modules/beans/src/test/resources/xml/MockCheckedRandomAccessList.xml
    harmony/enhanced/java/branches/java6/classlib/modules/beans/src/test/resources/xml/MockCheckedSet.xml
      - copied unchanged from r1022963, harmony/enhanced/java/trunk/classlib/modules/beans/src/test/resources/xml/MockCheckedSet.xml
    harmony/enhanced/java/branches/java6/classlib/modules/beans/src/test/resources/xml/MockCheckedSortedMap.xml
      - copied unchanged from r1022963, harmony/enhanced/java/trunk/classlib/modules/beans/src/test/resources/xml/MockCheckedSortedMap.xml
    harmony/enhanced/java/branches/java6/classlib/modules/beans/src/test/resources/xml/MockCheckedSortedSet.xml
      - copied unchanged from r1022963, harmony/enhanced/java/trunk/classlib/modules/beans/src/test/resources/xml/MockCheckedSortedSet.xml
    harmony/enhanced/java/branches/java6/classlib/modules/beans/src/test/resources/xml/MockGetPropertyClass.xml
      - copied unchanged from r1022963, harmony/enhanced/java/trunk/classlib/modules/beans/src/test/resources/xml/MockGetPropertyClass.xml
    harmony/enhanced/java/branches/java6/classlib/modules/beans/src/test/resources/xml/MockListImplements.xml
      - copied unchanged from r1022963, harmony/enhanced/java/trunk/classlib/modules/beans/src/test/resources/xml/MockListImplements.xml
    harmony/enhanced/java/branches/java6/classlib/modules/beans/src/test/resources/xml/MockSetImplements.xml
      - copied unchanged from r1022963, harmony/enhanced/java/trunk/classlib/modules/beans/src/test/resources/xml/MockSetImplements.xml
    harmony/enhanced/java/branches/java6/classlib/modules/beans/src/test/resources/xml/MockSynchronizedCollection.xml
      - copied unchanged from r1022963, harmony/enhanced/java/trunk/classlib/modules/beans/src/test/resources/xml/MockSynchronizedCollection.xml
    harmony/enhanced/java/branches/java6/classlib/modules/beans/src/test/resources/xml/MockSynchronizedList.xml
      - copied unchanged from r1022963, harmony/enhanced/java/trunk/classlib/modules/beans/src/test/resources/xml/MockSynchronizedList.xml
    harmony/enhanced/java/branches/java6/classlib/modules/beans/src/test/resources/xml/MockSynchronizedMap.xml
      - copied unchanged from r1022963, harmony/enhanced/java/trunk/classlib/modules/beans/src/test/resources/xml/MockSynchronizedMap.xml
    harmony/enhanced/java/branches/java6/classlib/modules/beans/src/test/resources/xml/MockSynchronizedRandomAccessList.xml
      - copied unchanged from r1022963, harmony/enhanced/java/trunk/classlib/modules/beans/src/test/resources/xml/MockSynchronizedRandomAccessList.xml
    harmony/enhanced/java/branches/java6/classlib/modules/beans/src/test/resources/xml/MockSynchronizedSet.xml
      - copied unchanged from r1022963, harmony/enhanced/java/trunk/classlib/modules/beans/src/test/resources/xml/MockSynchronizedSet.xml
    harmony/enhanced/java/branches/java6/classlib/modules/beans/src/test/resources/xml/MockSynchronizedSortedMap.xml
      - copied unchanged from r1022963, harmony/enhanced/java/trunk/classlib/modules/beans/src/test/resources/xml/MockSynchronizedSortedMap.xml
    harmony/enhanced/java/branches/java6/classlib/modules/beans/src/test/resources/xml/MockSynchronizedSortedSet.xml
      - copied unchanged from r1022963, harmony/enhanced/java/trunk/classlib/modules/beans/src/test/resources/xml/MockSynchronizedSortedSet.xml
    harmony/enhanced/java/branches/java6/classlib/modules/beans/src/test/resources/xml/MockUnmodifiableCollection.xml
      - copied unchanged from r1022963, harmony/enhanced/java/trunk/classlib/modules/beans/src/test/resources/xml/MockUnmodifiableCollection.xml
    harmony/enhanced/java/branches/java6/classlib/modules/beans/src/test/resources/xml/MockUnmodifiableList.xml
      - copied unchanged from r1022963, harmony/enhanced/java/trunk/classlib/modules/beans/src/test/resources/xml/MockUnmodifiableList.xml
    harmony/enhanced/java/branches/java6/classlib/modules/beans/src/test/resources/xml/MockUnmodifiableMap.xml
      - copied unchanged from r1022963, harmony/enhanced/java/trunk/classlib/modules/beans/src/test/resources/xml/MockUnmodifiableMap.xml
    harmony/enhanced/java/branches/java6/classlib/modules/beans/src/test/resources/xml/MockUnmodifiableRandomAccessList.xml
      - copied unchanged from r1022963, harmony/enhanced/java/trunk/classlib/modules/beans/src/test/resources/xml/MockUnmodifiableRandomAccessList.xml
    harmony/enhanced/java/branches/java6/classlib/modules/beans/src/test/resources/xml/MockUnmodifiableSet.xml
      - copied unchanged from r1022963, harmony/enhanced/java/trunk/classlib/modules/beans/src/test/resources/xml/MockUnmodifiableSet.xml
    harmony/enhanced/java/branches/java6/classlib/modules/beans/src/test/resources/xml/MockUnmodifiableSortedMap.xml
      - copied unchanged from r1022963, harmony/enhanced/java/trunk/classlib/modules/beans/src/test/resources/xml/MockUnmodifiableSortedMap.xml
    harmony/enhanced/java/branches/java6/classlib/modules/beans/src/test/resources/xml/MockUnmodifiableSortedSet.xml
      - copied unchanged from r1022963, harmony/enhanced/java/trunk/classlib/modules/beans/src/test/resources/xml/MockUnmodifiableSortedSet.xml
Modified:
    harmony/enhanced/java/branches/java6/   (props changed)
    harmony/enhanced/java/branches/java6/classlib/   (props changed)
    harmony/enhanced/java/branches/java6/classlib/depends/libs/   (props changed)
    harmony/enhanced/java/branches/java6/classlib/modules/beans/src/main/java/java/beans/DefaultPersistenceDelegate.java
    harmony/enhanced/java/branches/java6/classlib/modules/beans/src/main/java/java/beans/Encoder.java
    harmony/enhanced/java/branches/java6/classlib/modules/beans/src/main/java/java/beans/XMLEncoder.java
    harmony/enhanced/java/branches/java6/classlib/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/XMLEncoderTest.java
    harmony/enhanced/java/branches/java6/drlvm/   (props changed)
    harmony/enhanced/java/branches/java6/jdktools/   (props changed)

Propchange: harmony/enhanced/java/branches/java6/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Oct 27 13:42:28 2010
@@ -1,4 +1,4 @@
 /harmony/enhanced/java/branches/mrh:935751-941490
-/harmony/enhanced/java/trunk:929253-997624,997759,997980,997986,998010,998030,998619,998628,998759,998804,998822,999260,999286,999306,999591,999601,999623,999715-999716,999724,999793,1000005,1000169,1000213,1000229,1000231,1000233,1000240,1000245,1000248,1000265,1000527,1000689,1000696,1000699-1000700,1000705,1000708,1001065,1001080,1001153,1001187,1001490,1001609,1001638,1001652,1001723,1001741,1001744-1001745,1001751,1002080,1002189,1002476,1002480,1002488,1002506,1002511,1002592,1002736,1002971,1002988,1002990,1003089,1003094-1003095,1003109,1003513,1003744,1004471,1004624,1004837,1004906,1004908,1005084,1005391,1005441-1005442,1005648,1005651,1006115,1021745,1022064,1022390,1022493,1022832,1022846
+/harmony/enhanced/java/trunk:929253-997624,997759,997980,997986,998010,998030,998619,998628,998759,998804,998822,999260,999286,999306,999591,999601,999623,999715-999716,999724,999793,1000005,1000169,1000213,1000229,1000231,1000233,1000240,1000245,1000248,1000265,1000527,1000689,1000696,1000699-1000700,1000705,1000708,1001065,1001080,1001153,1001187,1001490,1001609,1001638,1001652,1001723,1001741,1001744-1001745,1001751,1002080,1002189,1002476,1002480,1002488,1002506,1002511,1002592,1002736,1002971,1002988,1002990,1003089,1003094-1003095,1003109,1003513,1003744,1004471,1004624,1004837,1004906,1004908,1005084,1005391,1005441-1005442,1005648,1005651,1006115,1021745,1022064,1022390,1022493,1022832,1022846,1022963
 /harmony/enhanced/trunk:476395-929252
 /incubator/harmony/enhanced/trunk:292550-476394

Propchange: harmony/enhanced/java/branches/java6/classlib/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Oct 27 13:42:28 2010
@@ -1,7 +1,7 @@
 /harmony/enhanced/classlib/trunk:713674-735919,765923-926091,926318-926838
 /harmony/enhanced/classlib/trunk/working_classlib:884014-884286
 /harmony/enhanced/java/branches/mrh/classlib:935751-941490
-/harmony/enhanced/java/trunk/classlib:929253-997624,997759,997980,997986,998010,998030,998619,998628,998759,998804,998822,999260,999286,999306,999591,999601,999623,999715-999716,999724,999793,1000005,1000169,1000213,1000229,1000231,1000233,1000240,1000245,1000248,1000265,1000527,1000689,1000696,1000699-1000700,1000705,1000708,1001065,1001080,1001153,1001187,1001490,1001609,1001638,1001652,1001723,1001741,1001744-1001745,1001751,1002080,1002189,1002476,1002480,1002488,1002506,1002511,1002592,1002736,1002971,1002988,1002990,1003089,1003094-1003095,1003109,1003513,1003744,1004471,1004624,1004837,1004906,1004908,1005084,1005391,1005441-1005442,1005648,1005651,1006115,1021745,1022064,1022390,1022493,1022832,1022846
+/harmony/enhanced/java/trunk/classlib:929253-997624,997759,997980,997986,998010,998030,998619,998628,998759,998804,998822,999260,999286,999306,999591,999601,999623,999715-999716,999724,999793,1000005,1000169,1000213,1000229,1000231,1000233,1000240,1000245,1000248,1000265,1000527,1000689,1000696,1000699-1000700,1000705,1000708,1001065,1001080,1001153,1001187,1001490,1001609,1001638,1001652,1001723,1001741,1001744-1001745,1001751,1002080,1002189,1002476,1002480,1002488,1002506,1002511,1002592,1002736,1002971,1002988,1002990,1003089,1003094-1003095,1003109,1003513,1003744,1004471,1004624,1004837,1004906,1004908,1005084,1005391,1005441-1005442,1005648,1005651,1006115,1021745,1022064,1022390,1022493,1022832,1022846,1022963
 /harmony/enhanced/trunk/classlib:476395-929252
 /harmony/enhanced/trunk/working_classlib:476396-920147
 /incubator/harmony/enhanced/trunk/classlib:292550-476394

Propchange: harmony/enhanced/java/branches/java6/classlib/depends/libs/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Oct 27 13:42:28 2010
@@ -1,4 +1,4 @@
 /harmony/enhanced/classlib/trunk/depends/libs:544451-926091
-/harmony/enhanced/java/trunk/classlib/depends/libs:929253-997624,997759,997980,997986,998010,998030,998619,998628,998759,998804,998822,999260,999286,999306,999591,999601,999623,999715-999716,999724,999793,1000005,1000169,1000213,1000229,1000231,1000233,1000240,1000245,1000248,1000265,1000527,1000689,1000696,1000699-1000700,1000705,1000708,1001065,1001080,1001153,1001187,1001490,1001609,1001638,1001652,1001723,1001741,1001744-1001745,1001751,1002080,1002189,1002476,1002480,1002488,1002506,1002511,1002592,1002736,1002971,1002988,1002990,1003089,1003094-1003095,1003109,1003513,1003744,1004471,1004624,1004837,1004906,1004908,1005084,1005391,1005441-1005442,1005648,1005651,1006115,1021745,1022064,1022390,1022493,1022832,1022846
+/harmony/enhanced/java/trunk/classlib/depends/libs:929253-997624,997759,997980,997986,998010,998030,998619,998628,998759,998804,998822,999260,999286,999306,999591,999601,999623,999715-999716,999724,999793,1000005,1000169,1000213,1000229,1000231,1000233,1000240,1000245,1000248,1000265,1000527,1000689,1000696,1000699-1000700,1000705,1000708,1001065,1001080,1001153,1001187,1001490,1001609,1001638,1001652,1001723,1001741,1001744-1001745,1001751,1002080,1002189,1002476,1002480,1002488,1002506,1002511,1002592,1002736,1002971,1002988,1002990,1003089,1003094-1003095,1003109,1003513,1003744,1004471,1004624,1004837,1004906,1004908,1005084,1005391,1005441-1005442,1005648,1005651,1006115,1021745,1022064,1022390,1022493,1022832,1022846,1022963
 /harmony/enhanced/trunk/classlib/depends/libs:476395-929252
 /incubator/harmony/enhanced/trunk/classlib/depends/libs:292550-476394

Modified: harmony/enhanced/java/branches/java6/classlib/modules/beans/src/main/java/java/beans/DefaultPersistenceDelegate.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/java6/classlib/modules/beans/src/main/java/java/beans/DefaultPersistenceDelegate.java?rev=1027958&r1=1027957&r2=1027958&view=diff
==============================================================================
--- harmony/enhanced/java/branches/java6/classlib/modules/beans/src/main/java/java/beans/DefaultPersistenceDelegate.java (original)
+++ harmony/enhanced/java/branches/java6/classlib/modules/beans/src/main/java/java/beans/DefaultPersistenceDelegate.java Wed Oct 27 13:42:28 2010
@@ -141,10 +141,8 @@ public class DefaultPersistenceDelegate 
                 Object targetVal = enc.get(oldVal);
                 Object newVal = new Expression(newInstance, getter.getName(),
                         null).getValue();
-                boolean invokeSetter = targetVal == null ? (newVal != null && oldVal == null)
-                        : !enc.getPersistenceDelegate(targetVal.getClass())
-                                .mutatesTo(targetVal, newVal);
-                if (invokeSetter) {
+                if (targetVal == null ? (newVal != null && oldVal == null)
+                        : targetVal != newVal && !targetVal.equals(newVal)) {
                     enc.writeStatement(new Statement(oldInstance, setter
                             .getName(), new Object[] { oldVal }));
                 }

Modified: harmony/enhanced/java/branches/java6/classlib/modules/beans/src/main/java/java/beans/Encoder.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/java6/classlib/modules/beans/src/main/java/java/beans/Encoder.java?rev=1027958&r1=1027957&r2=1027958&view=diff
==============================================================================
--- harmony/enhanced/java/branches/java6/classlib/modules/beans/src/main/java/java/beans/Encoder.java (original)
+++ harmony/enhanced/java/branches/java6/classlib/modules/beans/src/main/java/java/beans/Encoder.java Wed Oct 27 13:42:28 2010
@@ -71,6 +71,8 @@ public class Encoder {
 
     private static final LangEnumPersistenceDelegate langEnumPD = new LangEnumPersistenceDelegate();
 
+    private static final UtilCollectionsPersistenceDelegate utilCollectionsPD = new UtilCollectionsPersistenceDelegate();
+
     private static final ArrayPersistenceDelegate arrayPD = new ArrayPersistenceDelegate();
 
     private static final ProxyPersistenceDelegate proxyPD = new ProxyPersistenceDelegate();
@@ -105,6 +107,19 @@ public class Encoder {
         delegates.put(String.class, new StringPersistenceDelegate());
         delegates.put(Proxy.class, new ProxyPersistenceDelegate());
         delegates.put(Date.class, new UtilDatePersistenceDelegate());
+
+        PersistenceDelegate pd = new UtilListPersistenceDelegate();
+        delegates.put(java.util.List.class, pd);
+        delegates.put(java.util.AbstractList.class, pd);
+
+        pd = new UtilCollectionPersistenceDelegate();
+        delegates.put(java.util.Collection.class, pd);
+        delegates.put(java.util.AbstractCollection.class, pd);
+
+        pd = new UtilMapPersistenceDelegate();
+        delegates.put(java.util.Map.class, pd);
+        delegates.put(java.util.AbstractMap.class, pd);
+        delegates.put(java.util.Hashtable.class, pd);
     }
 
     private ExceptionListener listener = defaultExListener;
@@ -208,16 +223,9 @@ public class Encoder {
             return registeredPD;
         }
 
-        if (java.util.List.class.isAssignableFrom(type)) {
-            return new UtilListPersistenceDelegate();
-        }
-
-        if (java.util.Collection.class.isAssignableFrom(type)) {
-            return new UtilCollectionPersistenceDelegate();
-        }
-
-        if (java.util.Map.class.isAssignableFrom(type)) {
-            return new UtilMapPersistenceDelegate();
+        if (type.getName().startsWith(
+                UtilCollectionsPersistenceDelegate.CLASS_PREFIX)) {
+            return utilCollectionsPD;
         }
 
         if (type.isArray()) {

Modified: harmony/enhanced/java/branches/java6/classlib/modules/beans/src/main/java/java/beans/XMLEncoder.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/java6/classlib/modules/beans/src/main/java/java/beans/XMLEncoder.java?rev=1027958&r1=1027957&r2=1027958&view=diff
==============================================================================
--- harmony/enhanced/java/branches/java6/classlib/modules/beans/src/main/java/java/beans/XMLEncoder.java (original)
+++ harmony/enhanced/java/branches/java6/classlib/modules/beans/src/main/java/java/beans/XMLEncoder.java Wed Oct 27 13:42:28 2010
@@ -136,15 +136,6 @@ public class XMLEncoder extends Encoder 
         return buf;
     }
 
-    private String idSerialNoOfObject(Object obj) {
-        Class<?> clazz = obj.getClass();
-        Integer serialNo = (Integer) clazzCounterMap.get(clazz);
-        serialNo = serialNo == null ? 0 : serialNo;
-        String id = BeansUtils.idOfClass(obj.getClass()) + serialNo;
-        clazzCounterMap.put(clazz, ++serialNo);
-        return id;
-    }
-
     /**
      * Writes out all objects since last flush to the output stream.
      * <p>
@@ -512,7 +503,7 @@ public class XMLEncoder extends Encoder 
             List<?> subStats, int indent) {
         // open tag, begin
         flushIndent(indent);
-        String tagName = stat instanceof Expression ? "object" : "void";
+        String tagName = "void";
         out.print("<");
         out.print(tagName);
 
@@ -689,6 +680,15 @@ public class XMLEncoder extends Encoder 
         return (method.startsWith(BeansUtils.SET) && method.length() > 3 && args.length == 1);
     }
 
+    private String idSerialNoOfObject(Object obj) {
+        Class<?> clazz = obj.getClass();
+        Integer serialNo = (Integer) clazzCounterMap.get(clazz);
+        serialNo = serialNo == null ? 0 : serialNo;
+        String id = BeansUtils.idOfClass(obj.getClass()) + serialNo;
+        clazzCounterMap.put(clazz, ++serialNo);
+        return id;
+    }
+
     /*
      * The preprocess removes unused statements and counts references of every
      * object
@@ -799,17 +799,48 @@ public class XMLEncoder extends Encoder 
             return;
         }
         // deal with 'owner' property
-        if (stat.getTarget() == owner && owner != null) {
+        Object target = stat.getTarget();
+        if (target == owner && owner != null) {
             needOwner = true;
         }
 
         // record how a statement affects the target object
-        Record rec = objRecordMap.get(stat.getTarget());
+        Record rec = objRecordMap.get(target);
         if (rec == null) {
             rec = new Record();
-            objRecordMap.put(stat.getTarget(), rec);
+            objRecordMap.put(target, rec);
+        }
+
+        boolean hasRecord = false;
+        String methodName = stat.getMethodName();
+        Object[] args = stat.getArguments();
+        if (isSetPropertyStat(methodName, args)
+                || isSetArrayStat(target, methodName, args)) {
+            for (Statement subStat : rec.stats) {
+                if (target == subStat.getTarget()
+                        && methodName.equals(subStat.getMethodName())) {
+                    Object[] subArgs = subStat.getArguments();
+                    if (args.length == subArgs.length) {
+                        boolean equals = true;
+                        for (int index = 0; index < args.length; index++) {
+                            if (getPersistenceDelegate(args[index].getClass())
+                                    .mutatesTo(args[index], subArgs[index])) {
+                                continue;
+                            }
+                            equals = false;
+                            break;
+                        }
+                        if (equals) {
+                            hasRecord = true;
+                            break;
+                        }
+                    }
+                }
+            }
+        }
+        if (!hasRecord) {
+            rec.stats.add(stat);
         }
-        rec.stats.add(stat);
     }
 
     /**

Modified: harmony/enhanced/java/branches/java6/classlib/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/XMLEncoderTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/java6/classlib/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/XMLEncoderTest.java?rev=1027958&r1=1027957&r2=1027958&view=diff
==============================================================================
--- harmony/enhanced/java/branches/java6/classlib/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/XMLEncoderTest.java (original)
+++ harmony/enhanced/java/branches/java6/classlib/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/XMLEncoderTest.java Wed Oct 27 13:42:28 2010
@@ -36,10 +36,23 @@ import java.io.InputStreamReader;
 import java.io.OutputStream;
 import java.io.PrintWriter;
 import java.io.StringReader;
+import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Collection;
+import java.util.Collections;
 import java.util.Date;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.ListIterator;
 import java.util.Map;
+import java.util.Set;
+import java.util.SortedMap;
+import java.util.SortedSet;
 import java.util.TreeMap;
+import java.util.TreeSet;
 
 import junit.framework.TestCase;
 
@@ -1160,4 +1173,781 @@ public class XMLEncoderTest extends Test
         return ((0x0000 <= c && c < 0x0009) || (0x000a < c && c < 0x000d)
                 || (0x000d < c && c < 0x0020) || (0xd7ff < c && c < 0xe000) || c == 0xfffe);
     }
+
+    public static class MockUnmodifiableCollection {
+
+        private Collection<String> property = new ArrayList<String>();
+
+        public Collection<String> getProperty() {
+            return Collections.unmodifiableCollection(property);
+        }
+
+        public void setProperty(Collection<String> set) {
+            property.clear();
+            property.addAll(set);
+        }
+    }
+
+    public void testWriteObject_MockUnmodifiableCollection() throws Exception {
+        MockUnmodifiableCollection mockCollections = new MockUnmodifiableCollection();
+        Class<?> propertyClass = mockCollections.getProperty().getClass();
+        assertEquals("java.util.Collections$UnmodifiableCollection",
+                propertyClass.getName());
+        assertSamePD(propertyClass);
+        mockCollections.setProperty(Arrays
+                .asList(new String[] { "A", "B", "C" }));
+        assertCodedXML(mockCollections, "/xml/MockUnmodifiableCollection.xml");
+    }
+
+    public static class MockUnmodifiableList {
+
+        private List<String> property = new LinkedList<String>();
+
+        public Collection<String> getProperty() {
+            return Collections.unmodifiableList(property);
+        }
+
+        public void setProperty(Collection<String> set) {
+            property.clear();
+            property.addAll(set);
+        }
+    }
+
+    public void testWriteObject_MockUnmodifiableList() throws Exception {
+        MockUnmodifiableList mockCollections = new MockUnmodifiableList();
+        Class<?> propertyClass = mockCollections.getProperty().getClass();
+        assertEquals("java.util.Collections$UnmodifiableList",
+                propertyClass.getName());
+        assertSamePD(propertyClass);
+        mockCollections.setProperty(Arrays
+                .asList(new String[] { "A", "B", "C" }));
+        assertCodedXML(mockCollections, "/xml/MockUnmodifiableList.xml");
+    }
+
+    public static class MockUnmodifiableRandomAccessList {
+
+        private List<String> property = new ArrayList<String>();
+
+        public Collection<String> getProperty() {
+            return Collections.unmodifiableList(property);
+        }
+
+        public void setProperty(Collection<String> set) {
+            property.clear();
+            property.addAll(set);
+        }
+    }
+
+    public void testWriteObject_MockUnmodifiableRandomAccessList()
+            throws Exception {
+        MockUnmodifiableRandomAccessList mockCollections = new MockUnmodifiableRandomAccessList();
+        Class<?> propertyClass = mockCollections.getProperty().getClass();
+        assertEquals("java.util.Collections$UnmodifiableRandomAccessList",
+                propertyClass.getName());
+        assertSamePD(propertyClass);
+        mockCollections.setProperty(Arrays
+                .asList(new String[] { "A", "B", "C" }));
+        assertCodedXML(mockCollections,
+                "/xml/MockUnmodifiableRandomAccessList.xml");
+    }
+
+    public static class MockUnmodifiableSet {
+
+        private Set<String> property = new HashSet<String>();
+
+        public Collection<String> getProperty() {
+            return Collections.unmodifiableSet(property);
+        }
+
+        public void setProperty(Collection<String> set) {
+            property.clear();
+            property.addAll(set);
+        }
+    }
+
+    public void testWriteObject_MockUnmodifiableSet() throws Exception {
+        MockUnmodifiableSet mockCollections = new MockUnmodifiableSet();
+        Class<?> propertyClass = mockCollections.getProperty().getClass();
+        assertEquals("java.util.Collections$UnmodifiableSet",
+                propertyClass.getName());
+        assertSamePD(propertyClass);
+        Set<String> prop = new HashSet<String>();
+        prop.add("A");
+        prop.add("B");
+        prop.add("C");
+        mockCollections.setProperty(prop);
+        assertCodedXML(mockCollections, "/xml/MockUnmodifiableSet.xml");
+    }
+
+    public static class MockUnmodifiableSortedSet {
+
+        private SortedSet<String> property = new TreeSet<String>();
+
+        public Collection<String> getProperty() {
+            return Collections.unmodifiableSortedSet(property);
+        }
+
+        public void setProperty(Collection<String> set) {
+            property.clear();
+            property.addAll(set);
+        }
+    }
+
+    public void testWriteObject_MockUnmodifiableSortedSet() throws Exception {
+        MockUnmodifiableSortedSet mockCollections = new MockUnmodifiableSortedSet();
+        Class<?> propertyClass = mockCollections.getProperty().getClass();
+        assertEquals("java.util.Collections$UnmodifiableSortedSet",
+                propertyClass.getName());
+        assertSamePD(propertyClass);
+        Set<String> prop = new HashSet<String>();
+        prop.add("A");
+        prop.add("B");
+        prop.add("C");
+        mockCollections.setProperty(prop);
+        assertCodedXML(mockCollections, "/xml/MockUnmodifiableSortedSet.xml");
+    }
+
+    public static class MockUnmodifiableMap {
+
+        private Map<String, String> property = new HashMap<String, String>();
+
+        public Map<String, String> getProperty() {
+            return Collections.unmodifiableMap(property);
+        }
+
+        public void setProperty(Map<String, String> prop) {
+            property.clear();
+            property.putAll(prop);
+        }
+    }
+
+    public void testWriteObject_MockUnmodifiableMap() throws Exception {
+        MockUnmodifiableMap mockCollections = new MockUnmodifiableMap();
+        Class<?> propertyClass = mockCollections.getProperty().getClass();
+        assertEquals("java.util.Collections$UnmodifiableMap",
+                propertyClass.getName());
+        assertSamePD(propertyClass);
+        Map<String, String> prop = new HashMap<String, String>();
+        prop.put("A", "a");
+        prop.put("B", "b");
+        prop.put("C", "c");
+        mockCollections.setProperty(prop);
+        assertCodedXML(mockCollections, "/xml/MockUnmodifiableMap.xml");
+    }
+
+    public static class MockUnmodifiableSortedMap {
+
+        private SortedMap<String, String> property = new TreeMap<String, String>();
+
+        public Map<String, String> getProperty() {
+            return Collections.unmodifiableSortedMap(property);
+        }
+
+        public void setProperty(Map<String, String> prop) {
+            property.clear();
+            property.putAll(prop);
+        }
+    }
+
+    public void testWriteObject_MockUnmodifiableSortedMap() throws Exception {
+        MockUnmodifiableSortedMap mockCollections = new MockUnmodifiableSortedMap();
+        Class<?> propertyClass = mockCollections.getProperty().getClass();
+        assertEquals("java.util.Collections$UnmodifiableSortedMap",
+                propertyClass.getName());
+        assertSamePD(propertyClass);
+        Map<String, String> prop = new HashMap<String, String>();
+        prop.put("A", "a");
+        prop.put("B", "b");
+        prop.put("C", "c");
+        mockCollections.setProperty(prop);
+        assertCodedXML(mockCollections, "/xml/MockUnmodifiableSortedMap.xml");
+    }
+
+    public static class MockSynchronizedCollection {
+
+        private Collection<String> property = new ArrayList<String>();
+
+        public Collection<String> getProperty() {
+            return Collections.synchronizedCollection(property);
+        }
+
+        public void setProperty(Collection<String> prop) {
+            property.clear();
+            property.addAll(prop);
+        }
+    }
+
+    public void testWriteObject_MockSynchronizedCollection() throws Exception {
+        MockSynchronizedCollection mockCollections = new MockSynchronizedCollection();
+        Class<?> propertyClass = mockCollections.getProperty().getClass();
+        assertEquals("java.util.Collections$SynchronizedCollection",
+                propertyClass.getName());
+        assertSamePD(propertyClass);
+        mockCollections.setProperty(Arrays
+                .asList(new String[] { "A", "B", "C" }));
+        assertCodedXML(mockCollections, "/xml/MockSynchronizedCollection.xml");
+    }
+
+    public static class MockSynchronizedList {
+
+        private List<String> property = new LinkedList<String>();
+
+        public Collection<String> getProperty() {
+            return Collections.synchronizedList(property);
+        }
+
+        public void setProperty(Collection<String> prop) {
+            property.clear();
+            property.addAll(prop);
+        }
+    }
+
+    public void testWriteObject_MockSynchronizedList() throws Exception {
+        MockSynchronizedList mockCollections = new MockSynchronizedList();
+        Class<?> propertyClass = mockCollections.getProperty().getClass();
+        assertEquals("java.util.Collections$SynchronizedList",
+                propertyClass.getName());
+        assertSamePD(propertyClass);
+        mockCollections.setProperty(Arrays
+                .asList(new String[] { "A", "B", "C" }));
+        assertCodedXML(mockCollections, "/xml/MockSynchronizedList.xml");
+    }
+
+    public static class MockSynchronizedRandomAccessList {
+
+        private List<String> property = new ArrayList<String>();
+
+        public Collection<String> getProperty() {
+            return Collections.synchronizedList(property);
+        }
+
+        public void setProperty(Collection<String> prop) {
+            property.clear();
+            property.addAll(prop);
+        }
+    }
+
+    public void testWriteObject_MockSynchronizedRandomAccessList()
+            throws Exception {
+        MockSynchronizedRandomAccessList mockCollections = new MockSynchronizedRandomAccessList();
+        Class<?> propertyClass = mockCollections.getProperty().getClass();
+        assertEquals("java.util.Collections$SynchronizedRandomAccessList",
+                propertyClass.getName());
+        assertSamePD(propertyClass);
+        mockCollections.setProperty(Arrays
+                .asList(new String[] { "A", "B", "C" }));
+        assertCodedXML(mockCollections,
+                "/xml/MockSynchronizedRandomAccessList.xml");
+    }
+
+    public static class MockSynchronizedSet {
+
+        private Set<String> property = new HashSet<String>();
+
+        public Collection<String> getProperty() {
+            return Collections.synchronizedSet(property);
+        }
+
+        public void setProperty(Collection<String> prop) {
+            property.clear();
+            property.addAll(prop);
+        }
+    }
+
+    public void testWriteObject_MockSynchronizedSet() throws Exception {
+        MockSynchronizedSet mockCollections = new MockSynchronizedSet();
+        Class<?> propertyClass = mockCollections.getProperty().getClass();
+        assertEquals("java.util.Collections$SynchronizedSet",
+                propertyClass.getName());
+        assertSamePD(propertyClass);
+        mockCollections.setProperty(Arrays
+                .asList(new String[] { "A", "B", "C" }));
+        assertCodedXML(mockCollections, "/xml/MockSynchronizedSet.xml");
+    }
+
+    public static class MockSynchronizedSortedSet {
+
+        private SortedSet<String> property = new TreeSet<String>();
+
+        public Collection<String> getProperty() {
+            return Collections.synchronizedSortedSet(property);
+        }
+
+        public void setProperty(Collection<String> prop) {
+            property.clear();
+            property.addAll(prop);
+        }
+    }
+
+    public void testWriteObject_MockSynchronizedSortedSet() throws Exception {
+        MockSynchronizedSortedSet mockCollections = new MockSynchronizedSortedSet();
+        Class<?> propertyClass = mockCollections.getProperty().getClass();
+        assertEquals("java.util.Collections$SynchronizedSortedSet",
+                propertyClass.getName());
+        assertSamePD(propertyClass);
+        mockCollections.setProperty(Arrays
+                .asList(new String[] { "A", "B", "C" }));
+        assertCodedXML(mockCollections, "/xml/MockSynchronizedSortedSet.xml");
+    }
+
+    public static class MockSynchronizedMap {
+
+        private Map<String, String> property = new HashMap<String, String>();
+
+        public Map<String, String> getProperty() {
+            return Collections.synchronizedMap(property);
+        }
+
+        public void setProperty(Map<String, String> prop) {
+            property.clear();
+            property.putAll(prop);
+        }
+    }
+
+    public void testWriteObject_MockSynchronizedMap() throws Exception {
+        MockSynchronizedMap mockCollections = new MockSynchronizedMap();
+        Class<?> propertyClass = mockCollections.getProperty().getClass();
+        assertEquals("java.util.Collections$SynchronizedMap",
+                propertyClass.getName());
+        assertSamePD(propertyClass);
+        Map<String, String> prop = new HashMap<String, String>();
+        prop.put("A", "a");
+        prop.put("B", "b");
+        prop.put("C", "c");
+        mockCollections.setProperty(prop);
+        assertCodedXML(mockCollections, "/xml/MockSynchronizedMap.xml");
+    }
+
+    public static class MockSynchronizedSortedMap {
+
+        private SortedMap<String, String> property = new TreeMap<String, String>();
+
+        public Map<String, String> getProperty() {
+            return Collections.synchronizedSortedMap(property);
+        }
+
+        public void setProperty(Map<String, String> prop) {
+            property.clear();
+            property.putAll(prop);
+        }
+    }
+
+    public void testWriteObject_MockSynchronizedSortedMap() throws Exception {
+        MockSynchronizedSortedMap mockCollections = new MockSynchronizedSortedMap();
+        Class<?> propertyClass = mockCollections.getProperty().getClass();
+        assertEquals("java.util.Collections$SynchronizedSortedMap",
+                propertyClass.getName());
+        assertSamePD(propertyClass);
+        Map<String, String> prop = new HashMap<String, String>();
+        prop.put("A", "a");
+        prop.put("B", "b");
+        prop.put("C", "c");
+        mockCollections.setProperty(prop);
+        assertCodedXML(mockCollections, "/xml/MockSynchronizedSortedMap.xml");
+    }
+
+    public static class MockCheckedCollection {
+
+        private Collection<String> property = new ArrayList<String>();
+
+        public Collection<String> getProperty() {
+            return Collections.checkedCollection(property, String.class);
+        }
+
+        public void setProperty(Collection<String> prop) {
+            property.clear();
+            property.addAll(prop);
+        }
+    }
+
+    public void testWriteObject_MockCheckedCollection() throws Exception {
+        MockCheckedCollection mockCollections = new MockCheckedCollection();
+        Class<?> propertyClass = mockCollections.getProperty().getClass();
+        assertEquals("java.util.Collections$CheckedCollection",
+                propertyClass.getName());
+        assertSamePD(propertyClass);
+        mockCollections.setProperty(Arrays
+                .asList(new String[] { "A", "B", "C" }));
+        assertCodedXML(mockCollections, "/xml/MockCheckedCollection.xml");
+    }
+
+    public static class MockCheckedList {
+
+        private List<String> property = new LinkedList<String>();
+
+        public Collection<String> getProperty() {
+            return Collections.checkedList(property, String.class);
+        }
+
+        public void setProperty(Collection<String> prop) {
+            property.clear();
+            property.addAll(prop);
+        }
+    }
+
+    public void testWriteObject_MockCheckedList() throws Exception {
+        MockCheckedList mockCollections = new MockCheckedList();
+        Class<?> propertyClass = mockCollections.getProperty().getClass();
+        assertEquals("java.util.Collections$CheckedList",
+                propertyClass.getName());
+        assertSamePD(propertyClass);
+        mockCollections.setProperty(Arrays
+                .asList(new String[] { "A", "B", "C" }));
+        assertCodedXML(mockCollections, "/xml/MockCheckedList.xml");
+    }
+
+    public static class MockCheckedRandomAccessList {
+
+        private List<String> property = new ArrayList<String>();
+
+        public Collection<String> getProperty() {
+            return Collections.checkedList(property, String.class);
+        }
+
+        public void setProperty(Collection<String> prop) {
+            property.clear();
+            property.addAll(prop);
+        }
+    }
+
+    public void testWriteObject_MockCheckedRandomAccessList() throws Exception {
+        MockCheckedRandomAccessList mockCollections = new MockCheckedRandomAccessList();
+        Class<?> propertyClass = mockCollections.getProperty().getClass();
+        assertEquals("java.util.Collections$CheckedRandomAccessList",
+                propertyClass.getName());
+        assertSamePD(propertyClass);
+        mockCollections.setProperty(Arrays
+                .asList(new String[] { "A", "B", "C" }));
+        assertCodedXML(mockCollections, "/xml/MockCheckedRandomAccessList.xml");
+    }
+
+    public static class MockCheckedSet {
+
+        private Set<String> property = new HashSet<String>();
+
+        public Collection<String> getProperty() {
+            return Collections.checkedSet(property, String.class);
+        }
+
+        public void setProperty(Collection<String> prop) {
+            property.clear();
+            property.addAll(prop);
+        }
+    }
+
+    public void testWriteObject_MockCheckedSet() throws Exception {
+        MockCheckedSet mockCollections = new MockCheckedSet();
+        Class<?> propertyClass = mockCollections.getProperty().getClass();
+        assertEquals("java.util.Collections$CheckedSet",
+                propertyClass.getName());
+        assertSamePD(propertyClass);
+        mockCollections.setProperty(Arrays
+                .asList(new String[] { "A", "B", "C" }));
+        assertCodedXML(mockCollections, "/xml/MockCheckedSet.xml");
+    }
+
+    public static class MockCheckedSortedSet {
+
+        private SortedSet<String> property = new TreeSet<String>();
+
+        public Collection<String> getProperty() {
+            return Collections.checkedSortedSet(property, String.class);
+        }
+
+        public void setProperty(Collection<String> prop) {
+            property.clear();
+            property.addAll(prop);
+        }
+    }
+
+    public void testWriteObject_MockCheckedSortedSet() throws Exception {
+        MockCheckedSortedSet mockCollections = new MockCheckedSortedSet();
+        Class<?> propertyClass = mockCollections.getProperty().getClass();
+        assertEquals("java.util.Collections$CheckedSortedSet",
+                propertyClass.getName());
+        assertSamePD(propertyClass);
+        mockCollections.setProperty(Arrays
+                .asList(new String[] { "A", "B", "C" }));
+        assertCodedXML(mockCollections, "/xml/MockCheckedSortedSet.xml");
+    }
+
+    public static class MockCheckedMap {
+
+        private Map<String, String> property = new HashMap<String, String>();
+
+        public Map<String, String> getProperty() {
+            return Collections.checkedMap(property, String.class, String.class);
+        }
+
+        public void setProperty(Map<String, String> prop) {
+            property.clear();
+            property.putAll(prop);
+        }
+    }
+
+    public void testWriteObject_MockCheckedMap() throws Exception {
+        MockCheckedMap mockCollections = new MockCheckedMap();
+        Class<?> propertyClass = mockCollections.getProperty().getClass();
+        assertEquals("java.util.Collections$CheckedMap",
+                propertyClass.getName());
+        assertSamePD(propertyClass);
+        Map<String, String> prop = new HashMap<String, String>();
+        prop.put("A", "a");
+        prop.put("B", "b");
+        prop.put("C", "c");
+        mockCollections.setProperty(prop);
+        assertCodedXML(mockCollections, "/xml/MockCheckedMap.xml");
+    }
+
+    public static class MockCheckedSortedMap {
+
+        private SortedMap<String, String> property = new TreeMap<String, String>();
+
+        public Map<String, String> getProperty() {
+            return Collections.checkedSortedMap(property, String.class,
+                    String.class);
+        }
+
+        public void setProperty(Map<String, String> prop) {
+            property.clear();
+            property.putAll(prop);
+        }
+    }
+
+    public void testWriteObject_MockCheckedSortedMap() throws Exception {
+        MockCheckedSortedMap mockCollections = new MockCheckedSortedMap();
+        Class<?> propertyClass = mockCollections.getProperty().getClass();
+        assertEquals("java.util.Collections$CheckedSortedMap",
+                propertyClass.getName());
+        assertSamePD(propertyClass);
+        Map<String, String> prop = new HashMap<String, String>();
+        prop.put("A", "a");
+        prop.put("B", "b");
+        prop.put("C", "c");
+        mockCollections.setProperty(prop);
+        assertCodedXML(mockCollections, "/xml/MockCheckedSortedMap.xml");
+    }
+
+    public static class MockGetPropertyClass {
+
+        private Set<String> property = new HashSet<String>();
+
+        public Set<String> getProperty() {
+            return new HashSet<String>(property);
+        }
+
+        public void setProperty(Set<String> set) {
+            property.clear();
+            property.addAll(set);
+        }
+    }
+
+    public void testWriteObject_MockGetPropertyClass() throws Exception {
+        MockGetPropertyClass mockCollections = new MockGetPropertyClass();
+        assertSamePD(mockCollections.getProperty().getClass());
+        Set<String> prop = new HashSet<String>();
+        prop.add("A");
+        prop.add("B");
+        prop.add("C");
+        mockCollections.setProperty(prop);
+        assertCodedXML(mockCollections, "/xml/MockGetPropertyClass.xml");
+    }
+
+    public static class MockListImplements implements List<String> {
+
+        private List<String> property = new ArrayList<String>();
+
+        public List<String> getProperty() {
+            return property;
+        }
+
+        public void setProperty(List<String> prop) {
+            property = prop;
+        }
+
+        public boolean add(String o) {
+            return property.add(o);
+        }
+
+        public void add(int index, String o) {
+            property.add(index, o);
+        }
+
+        public boolean addAll(Collection<? extends String> c) {
+            return property.addAll(c);
+        }
+
+        public boolean addAll(int index, Collection<? extends String> c) {
+            return property.addAll(index, c);
+        }
+
+        public void clear() {
+            property.clear();
+        }
+
+        public boolean contains(Object o) {
+            return property.contains(o);
+        }
+
+        public boolean containsAll(Collection<?> c) {
+            return property.containsAll(c);
+        }
+
+        public String get(int index) {
+            return property.get(index);
+        }
+
+        public int indexOf(Object o) {
+            return property.indexOf(o);
+        }
+
+        public boolean isEmpty() {
+            return property.isEmpty();
+        }
+
+        public Iterator<String> iterator() {
+            return property.iterator();
+        }
+
+        public int lastIndexOf(Object o) {
+            return property.lastIndexOf(o);
+        }
+
+        public ListIterator<String> listIterator() {
+            return property.listIterator();
+        }
+
+        public ListIterator<String> listIterator(int index) {
+            return property.listIterator(index);
+        }
+
+        public boolean remove(Object o) {
+            return property.remove(o);
+        }
+
+        public String remove(int index) {
+            return property.remove(index);
+        }
+
+        public boolean removeAll(Collection<?> c) {
+            return property.removeAll(c);
+        }
+
+        public boolean retainAll(Collection<?> c) {
+            return property.retainAll(c);
+        }
+
+        public String set(int index, String o) {
+            return property.set(index, o);
+        }
+
+        public int size() {
+            return property.size();
+        }
+
+        public List<String> subList(int fromIndex, int toIndex) {
+            return property.subList(fromIndex, toIndex);
+        }
+
+        public Object[] toArray() {
+            return property.toArray();
+        }
+
+        public <T> T[] toArray(T[] a) {
+            return property.toArray(a);
+        }
+    }
+
+    public void testWriteObject_MockListImplements() throws Exception {
+        List<String> mockListImplements = new MockListImplements();
+        mockListImplements.add("A");
+        assertCodedXML(mockListImplements, "/xml/MockListImplements.xml");
+    }
+
+    public static class MockSetImplements implements Set<String> {
+
+        private Set<String> property;
+
+        public MockSetImplements() {
+            property = new HashSet<String>();
+        }
+
+        public Set<String> getProperty() {
+            return property;
+        }
+
+        public void setProperty(Set<String> prop) {
+            property = prop;
+        }
+
+        public boolean add(String o) {
+            return property.add(o);
+        }
+
+        public void clear() {
+            property.clear();
+        }
+
+        public boolean contains(final Object o) {
+            return property.contains(o);
+        }
+
+        public boolean containsAll(final Collection<?> c) {
+            return property.containsAll(c);
+        }
+
+        public boolean isEmpty() {
+            return property.isEmpty();
+        }
+
+        public Iterator<String> iterator() {
+            return property.iterator();
+        }
+
+        public boolean remove(final Object o) {
+            return property.remove(o);
+        }
+
+        public boolean removeAll(final Collection<?> c) {
+            return property.removeAll(c);
+        }
+
+        public boolean retainAll(final Collection<?> c) {
+            return property.retainAll(c);
+        }
+
+        public int size() {
+            return property.size();
+        }
+
+        public Object[] toArray() {
+            return property.toArray();
+        }
+
+        public <T> T[] toArray(final T[] a) {
+            return property.toArray(a);
+        }
+
+        public int hashCode() {
+            return property.hashCode();
+        }
+
+        public boolean addAll(Collection<? extends String> c) {
+            return property.addAll(c);
+        }
+    }
+
+    public void testWriteObject_MockSetImplements() throws Exception {
+        Set<String> mockSetImplements = new MockSetImplements();
+        mockSetImplements.add("A");
+        assertCodedXML(mockSetImplements, "/xml/MockSetImplements.xml");
+    }
+
+    private Encoder encoder = new Encoder();
+
+    private void assertSamePD(Class<?> clazz) {
+        assertSame(encoder.getPersistenceDelegate(clazz),
+                encoder.getPersistenceDelegate(clazz));
+    }
+
 }
\ No newline at end of file

Propchange: harmony/enhanced/java/branches/java6/drlvm/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Oct 27 13:42:28 2010
@@ -1,5 +1,5 @@
 /harmony/enhanced/java/branches/mrh/drlvm:935751-941490
-/harmony/enhanced/java/trunk/drlvm:929253-997624,997759,997980,997986,998010,998030,998619,998628,998759,998804,998822,999260,999286,999306,999591,999601,999623,999715-999716,999724,999793,1000005,1000169,1000213,1000229,1000231,1000233,1000240,1000245,1000248,1000265,1000527,1000689,1000696,1000699-1000700,1000705,1000708,1001065,1001080,1001153,1001187,1001490,1001609,1001638,1001652,1001723,1001741,1001744-1001745,1001751,1002080,1002189,1002476,1002480,1002488,1002506,1002511,1002592,1002736,1002971,1002988,1002990,1003089,1003094-1003095,1003109,1003513,1003744,1004471,1004624,1004837,1004906,1004908,1005084,1005391,1005441-1005442,1005648,1005651,1006115,1021745,1022064,1022390,1022493,1022832,1022846
+/harmony/enhanced/java/trunk/drlvm:929253-997624,997759,997980,997986,998010,998030,998619,998628,998759,998804,998822,999260,999286,999306,999591,999601,999623,999715-999716,999724,999793,1000005,1000169,1000213,1000229,1000231,1000233,1000240,1000245,1000248,1000265,1000527,1000689,1000696,1000699-1000700,1000705,1000708,1001065,1001080,1001153,1001187,1001490,1001609,1001638,1001652,1001723,1001741,1001744-1001745,1001751,1002080,1002189,1002476,1002480,1002488,1002506,1002511,1002592,1002736,1002971,1002988,1002990,1003089,1003094-1003095,1003109,1003513,1003744,1004471,1004624,1004837,1004906,1004908,1005084,1005391,1005441-1005442,1005648,1005651,1006115,1021745,1022064,1022390,1022493,1022832,1022846,1022963
 /harmony/enhanced/trunk/drlvm:476395-929252
 /harmony/enhanced/trunk/working_vm:476396-920147
 /incubator/harmony/enhanced/trunk/drlvm:292550-476394

Propchange: harmony/enhanced/java/branches/java6/jdktools/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Oct 27 13:42:28 2010
@@ -1,4 +1,4 @@
-/harmony/enhanced/java/trunk/jdktools:929253-997624,997759,997980,997986,998010,998030,998619,998628,998759,998804,998822,999260,999286,999306,999591,999601,999623,999715-999716,999724,999793,1000005,1000169,1000213,1000229,1000231,1000233,1000240,1000245,1000248,1000265,1000527,1000689,1000696,1000699-1000700,1000705,1000708,1001065,1001080,1001153,1001187,1001490,1001609,1001638,1001652,1001723,1001741,1001744-1001745,1001751,1002080,1002189,1002476,1002480,1002488,1002506,1002511,1002592,1002736,1002971,1002988,1002990,1003089,1003094-1003095,1003109,1003513,1003744,1004471,1004624,1004837,1004906,1004908,1005084,1005391,1005441-1005442,1005648,1005651,1006115,1021745,1022064,1022390,1022493,1022832,1022846
+/harmony/enhanced/java/trunk/jdktools:929253-997624,997759,997980,997986,998010,998030,998619,998628,998759,998804,998822,999260,999286,999306,999591,999601,999623,999715-999716,999724,999793,1000005,1000169,1000213,1000229,1000231,1000233,1000240,1000245,1000248,1000265,1000527,1000689,1000696,1000699-1000700,1000705,1000708,1001065,1001080,1001153,1001187,1001490,1001609,1001638,1001652,1001723,1001741,1001744-1001745,1001751,1002080,1002189,1002476,1002480,1002488,1002506,1002511,1002592,1002736,1002971,1002988,1002990,1003089,1003094-1003095,1003109,1003513,1003744,1004471,1004624,1004837,1004906,1004908,1005084,1005391,1005441-1005442,1005648,1005651,1006115,1021745,1022064,1022390,1022493,1022832,1022846,1022963
 /harmony/enhanced/jdktools/trunk:630107-925933
 /harmony/enhanced/trunk/jdktools:476395-929252
 /harmony/enhanced/trunk/working_jdktools:476396-920147