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

Constructor reference to non-reifiable array should be rejected

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P3
    • 8
    • 8
    • tools
    • b82
    • Verified

    Description

      This program should not compile:

      import java.util.ArrayList;
      import java.util.List;
      interface I {
              List<String> [] doit(int x);
      }
      public class X {
         I i1 = ArrayList<String>[]::new; // Compiles OK
         I i2 = List<String>[]::new; // Compiles OK
         List<String> [] ls = new ArrayList<String>[10]; // Error.
      }

      Attachments

        Activity

          People

            mcimadamore Maurizio Cimadamore
            mcimadamore Maurizio Cimadamore
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: