summaryrefslogtreecommitdiff
path: root/libjava
diff options
context:
space:
mode:
Diffstat (limited to 'libjava')
-rw-r--r--libjava/ChangeLog3
-rw-r--r--libjava/java/util/AbstractMap.java8
-rw-r--r--libjava/java/util/IdentityHashMap.java17
3 files changed, 25 insertions, 3 deletions
diff --git a/libjava/ChangeLog b/libjava/ChangeLog
index 1a542aaa22f..0a9400f0128 100644
--- a/libjava/ChangeLog
+++ b/libjava/ChangeLog
@@ -1,5 +1,8 @@
2001-09-04 Tom Tromey <tromey@redhat.com>
+ * java/util/AbstractMap.java: Re-merged with Classpath.
+ * java/util/IdentityHashMap.java: Re-merged with Classpath.
+
* java/text/SimpleDateFormat.java: Re-merged with Classpath.
* gnu/gcj/text/LocaleData.java, gnu/gcj/text/LocaleData_en.java,
gnu/gcj/text/LocaleData_en_US.java: Removed.
diff --git a/libjava/java/util/AbstractMap.java b/libjava/java/util/AbstractMap.java
index 7ce73053a08..e28ce919beb 100644
--- a/libjava/java/util/AbstractMap.java
+++ b/libjava/java/util/AbstractMap.java
@@ -47,6 +47,14 @@ public abstract class AbstractMap implements Map
entrySet().clear();
}
+ /**
+ * Create a shallow copy of this Map, no keys or values are copied.
+ */
+ protected Object clone () throws CloneNotSupportedException
+ {
+ return super.clone ();
+ }
+
public boolean containsKey(Object key)
{
Object k;
diff --git a/libjava/java/util/IdentityHashMap.java b/libjava/java/util/IdentityHashMap.java
index 5a1d76b2941..c23f8ac3dd4 100644
--- a/libjava/java/util/IdentityHashMap.java
+++ b/libjava/java/util/IdentityHashMap.java
@@ -83,11 +83,22 @@ public class IdentityHashMap extends AbstractMap
size = 0;
}
+ /**
+ * Creates a shallow copy where keys and values are not cloned.
+ */
public Object clone ()
{
- IdentityHashMap copy = (IdentityHashMap) super.clone ();
- copy.table = (Object[]) table.clone ();
- return copy;
+ try
+ {
+ IdentityHashMap copy = (IdentityHashMap) super.clone ();
+ copy.table = (Object[]) table.clone ();
+ return copy;
+ }
+ catch (CloneNotSupportedException e)
+ {
+ // Can't happen.
+ return null;
+ }
}
public boolean containsKey (Object key)