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

Typo in 'Restrictions on Generics"

    XMLWordPrintable

    Details

    • Type: Enhancement
    • Status: Resolved
    • Priority: P5
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: docs
    • Labels:
      None

      Description

      In

      http://docs.oracle.com/javase/tutorial/java/generics/restrictions.html#createArrays

       If you try the same thing with a generic list, there would be a problem:

      Object[] stringLists = new List<String>[]; // compiler error, but pretend it's allowed
      stringLists[0] = new ArrayList<String>(); // OK
      stringLists[1] = new ArrayList<Integer>(); // An ArrayStoreException should be thrown,
                                                  // but the runtime can't detect it.


      new List<String>[] -> new List<String>[2];

        Attachments

          Activity

            People

            Assignee:
            bhoran Bernard Horan
            Reporter:
            rgallard Raymond Gallardo
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: