This makes the Mauve Collections tests all pass again. Our unmodifiable toArray methods had the wrong signature :(
Changelog:
2006-12-15 Andrew John Hughes <[EMAIL PROTECTED]>
* java/util/Collections.java:
(toArray()): Return Object[] as required.
(toArray(S[])): Use new type variable S rather than
the class one.
--
Andrew :-)
Escape the Java Trap with GNU Classpath!
http://www.gnu.org/philosophy/java-trap.html
public class gcj extends Freedom implements Java { ... }
Index: java/util/Collections.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/util/Collections.java,v
retrieving revision 1.45
diff -u -3 -p -u -r1.45 Collections.java
--- java/util/Collections.java 14 Dec 2006 07:24:43 -0000 1.45
+++ java/util/Collections.java 15 Dec 2006 22:05:28 -0000
@@ -5113,7 +5113,7 @@ public class Collections
// The array returned is an array of UnmodifiableMapEntry instead of
// Map.Entry
- public Map.Entry<K,V>[] toArray()
+ public Object[] toArray()
{
Object[] mapEntryResult = super.toArray();
UnmodifiableMapEntry<K,V> result[] = null;
@@ -5127,17 +5127,17 @@ public class Collections
}
return result;
}
-
+
// The array returned is an array of UnmodifiableMapEntry instead of
// Map.Entry
- public Map.Entry<K,V>[] toArray(Map.Entry<K,V>[] array)
+ public <S> S[] toArray(S[] array)
{
- super.toArray(array);
+ S[] result = super.toArray(array);
- if (array != null)
- for (int i = 0; i < array.length; i++)
+ if (result != null)
+ for (int i = 0; i < result.length; i++)
array[i] =
- new UnmodifiableMapEntry<K,V>(array[i]);
+ (S) new UnmodifiableMapEntry<K,V>((Map.Entry<K,V>) result[i]);
return array;
}
signature.asc
Description: Digital signature
