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

XMLWordPrintable

    • Type: Bug
    • Resolution: Not an Issue
    • Priority: P3
    • None
    • Affects Version/s: 5.0
    • Component/s: 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

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

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: