Details
-
Type:
Defect
-
Status:
Closed
-
Priority:
Major
-
Resolution: Completed
-
Affects Version/s: None
-
Fix Version/s: None
-
Component/s: None
-
Labels:None
-
Patch:Code and Test
-
Approval:Ok
Description
Per http://docs.oracle.com/javase/6/docs/api/index.html?java/util/Collections.html, Collection.toArray(T []) implements must allocate an array of type T[], not Object[]. This will cause type-casty code to break. Not often a problem in Clojure, but e.g. it makes Clojure defrecords unprintable from the JRuby console.
There is also a chance to DRY up some common code, as the six places that have this problem should all call an RT helper.
This also fixes toArray(T[]) for PersistentQueue when the passed array has the same length as the queue.
Attachments
Activity
Stuart Halloway
made changes -
| Field | Original Value | New Value |
|---|---|---|
| Summary | Collection.toArray implementations to not conform to Java API docs | Collection.toArray implementations do not conform to Java API docs |
Stuart Halloway
made changes -
| Patch | Code [ 10001 ] | |
| Attachment | 0895-to-array.patch [ 10738 ] |
Stuart Halloway
made changes -
| Attachment | 0895-to-array-take-2.patch [ 10739 ] |
Cosmin Stejerean
made changes -
| Attachment | 0895-to-array-take-3.patch [ 10740 ] |
Cosmin Stejerean
made changes -
| Attachment | 0895-to-array-tests.patch [ 10741 ] |
Cosmin Stejerean
made changes -
| Patch | Code [ 10001 ] | Code and Test [ 10002 ] |
| Description |
Per http://docs.oracle.com/javase/6/docs/api/index.html?java/util/Collections.html, Collection.toArray(T []) implements must allocate an array of type T[], not Object[]. This will cause type-casty code to break. Not often a problem in Clojure, but e.g. it makes Clojure defrecords unprintable from the JRuby console.
There is also a chance to DRY up some common code, as the six places that have this problem should all call an RT helper. |
Per http://docs.oracle.com/javase/6/docs/api/index.html?java/util/Collections.html, Collection.toArray(T []) implements must allocate an array of type T[], not Object[]. This will cause type-casty code to break. Not often a problem in Clojure, but e.g. it makes Clojure defrecords unprintable from the JRuby console.
There is also a chance to DRY up some common code, as the six places that have this problem should all call an RT helper. This also fixes toArray(T[]) for PersistentQueue when the passed array has the same length as the queue. |
Stuart Sierra
made changes -
| Approval | Vetted [ 10003 ] | Incomplete [ 10006 ] |
Cosmin Stejerean
made changes -
| Attachment | 0895-to-array-take-3.patch [ 10740 ] |
Cosmin Stejerean
made changes -
| Attachment | 0895-to-array-tests.patch [ 10741 ] |
Cosmin Stejerean
made changes -
| Attachment | 0001-CLJ-895.-Use-RT.seqToPassedArray-to-implement-Collec.patch [ 10799 ] |
Stuart Halloway
made changes -
| Approval | Incomplete [ 10006 ] | Screened [ 10004 ] |
| Attachment | 0895-take-4.patch [ 10928 ] |
Rich Hickey
made changes -
| Approval | Screened [ 10004 ] | Ok [ 10007 ] |
Stuart Halloway
made changes -
| Attachment | 0895-take-5.patch [ 10929 ] |
Stuart Halloway
made changes -
| Resolution | Completed [ 1 ] | |
| Status | Open [ 1 ] | Resolved [ 5 ] |
Stuart Halloway
made changes -
| Status | Resolved [ 5 ] | Closed [ 6 ] |