Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-5063030

"<T> T[] Collection.toArray(T[])" should be "<T super E> T[] Coll

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3
    • Resolution: Not an Issue
    • Affects Version/s: 5.0
    • Fix Version/s: None
    • Component/s: core-libs
    • Labels:
      None

      Description

      I might be missing something, but the current signature of Collection.toArray(T[] a) allows the following incorrect code:

        Collection<Integer> l = ...;
        l.toArray( new Long[0] );

      Changing the method signature to <T super E> would make the above code illegal,
      while allowing all the valid uses legal.

      ###@###.### 2004-06-14
      ###@###.### 2004-06-14

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                gafter Neal Gafter
                Reporter:
                kkawagucsunw Kohsuke Kawaguchi (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: