-
Bug
-
Resolution: Fixed
-
P4
-
1.2.2
-
beta
-
generic
-
generic
-
Verified
The spec for Collection.toArray(Object[]) is unclear on what happens when collection elements are not assignment compatible with the array element type. Worse, it seems to imply that *all* elements that are assignment compatible will be returned. In fact the implementations currently just bail the first time an element can't be stuffed in the array. The spec for AbstractCollection.toArray(Object[]) is somewhat better (though grammatically incorrect).
At the very least, the specs for Collection and AbstractCollection and all of the general purpose implementations should be brought into accord, and none should appear to promise something that they don't deliver.
Perhaps we should tighten up the behavior as well, and clarify the spec to indicate that *all* elements of appropriate type will be returned even if one or more are not of appropriate type. I'm not sure...
At the very least, the specs for Collection and AbstractCollection and all of the general purpose implementations should be brought into accord, and none should appear to promise something that they don't deliver.
Perhaps we should tighten up the behavior as well, and clarify the spec to indicate that *all* elements of appropriate type will be returned even if one or more are not of appropriate type. I'm not sure...