# HG changeset patch # User smarks # Date 1512082176 28800 # Node ID 81b5e3f70d984b955a206ee5f5384ccd2a01bd13 # Parent 47b764e0a38a5af452fd011d21051a6d36909fcf 8160406: Collection.toArray() spec should be explicit about returning precisely an Object[] Reviewed-by: psandoz, martin, redestad diff -r 47b764e0a38a -r 81b5e3f70d98 src/java.base/share/classes/java/util/Collection.java --- a/src/java.base/share/classes/java/util/Collection.java Thu Nov 30 16:38:31 2017 -0500 +++ b/src/java.base/share/classes/java/util/Collection.java Thu Nov 30 14:49:36 2017 -0800 @@ -192,7 +192,8 @@ * Returns an array containing all of the elements in this collection. * If this collection makes any guarantees as to what order its elements * are returned by its iterator, this method must return the elements in - * the same order. + * the same order. The returned array's {@linkplain Class#getComponentType + * runtime component type} is {@code Object}. * *
The returned array will be "safe" in that no references to it are * maintained by this collection. (In other words, this method must @@ -202,7 +203,8 @@ *
This method acts as bridge between array-based and collection-based
* APIs.
*
- * @return an array containing all of the elements in this collection
+ * @return an array, whose {@linkplain Class#getComponentType runtime component
+ * type} is {@code Object}, containing all of the elements in this collection
*/
Object[] toArray();
@@ -239,14 +241,14 @@
* Note that {@code toArray(new Object[0])} is identical in function to
* {@code toArray()}.
*
- * @param