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

Typo in 'Restrictions on Generics"

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P5 P5
    • None
    • None
    • docs
    • None

      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];

            bhoran Bernard Horan (Inactive)
            rgallard Raymond Gallardo
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: