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

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

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P3 P3
    • None
    • 5.0
    • core-libs
    • None

      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

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

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: