diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index dc8c3c2a7..229405ba7 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -22,6 +22,9 @@
+
+ MultiKeyMap.clone() now correctly calls super.clone().
+
Use of final keyword where applicable, minor performance improvements by properly
initializing the capacity of newly created collections when known in advance.
diff --git a/src/main/java/org/apache/commons/collections/map/MultiKeyMap.java b/src/main/java/org/apache/commons/collections/map/MultiKeyMap.java
index 42cc29196..87491fc9e 100644
--- a/src/main/java/org/apache/commons/collections/map/MultiKeyMap.java
+++ b/src/main/java/org/apache/commons/collections/map/MultiKeyMap.java
@@ -16,6 +16,9 @@
*/
package org.apache.commons.collections.map;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.util.Map;
@@ -78,10 +81,6 @@ public class MultiKeyMap extends AbstractMapDecorator, V> map;
-
//-----------------------------------------------------------------------
/**
* Decorates the specified map to add the MultiKeyMap API and fast query.
@@ -819,9 +818,14 @@ public class MultiKeyMap extends AbstractMapDecorator clone() {
- return new MultiKeyMap(decorated().clone());
+ try {
+ return (MultiKeyMap) super.clone();
+ } catch (CloneNotSupportedException e) {
+ throw new InternalError();
+ }
}
/**
@@ -867,6 +871,32 @@ public class MultiKeyMap extends AbstractMapDecorator, V> decorated() {
- return map;
+ return (AbstractHashedMap, V>) super.decorated();
}
+
+ //-----------------------------------------------------------------------
+ /**
+ * Write the map out using a custom routine.
+ *
+ * @param out the output stream
+ * @throws IOException
+ */
+ private void writeObject(final ObjectOutputStream out) throws IOException {
+ out.defaultWriteObject();
+ out.writeObject(map);
+ }
+
+ /**
+ * Read the map in using a custom routine.
+ *
+ * @param in the input stream
+ * @throws IOException
+ * @throws ClassNotFoundException
+ */
+ @SuppressWarnings("unchecked")
+ private void readObject(final ObjectInputStream in) throws IOException, ClassNotFoundException {
+ in.defaultReadObject();
+ map = (Map, V>) in.readObject();
+ }
+
}
diff --git a/src/test/java/org/apache/commons/collections/map/MultiKeyMapTest.java b/src/test/java/org/apache/commons/collections/map/MultiKeyMapTest.java
index 1a82ab95c..7913551f5 100644
--- a/src/test/java/org/apache/commons/collections/map/MultiKeyMapTest.java
+++ b/src/test/java/org/apache/commons/collections/map/MultiKeyMapTest.java
@@ -441,18 +441,18 @@ public class MultiKeyMapTest extends AbstractIterableMapTest