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

Qualified class name is erroneously rejected inside qualified instance creation expression

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P4 P4
    • tbd
    • 8, 9, 10, 11, 12
    • tools
    • None
    • 8

      Consider the following code:

      class Test {
          class Inner {}

          void test() {
              new Test.Inner(); // compiles successfully
              this.new Test.Inner(); // error
          }
      }

      javac reports:
      Test.java:6: error: '(' expected
              this.new Test.Inner();
                           ^
      1 error

      However, per JLS 15.9, such code should be accepted. (Relative to JLS7, JLS8 expanded the grammar of class instance creation expressions. See http://mail.openjdk.java.net/pipermail/compiler-dev/2019-January/012923.html for details.)

        1. 8218194
          4 kB
        2. jdk8218194c.patch
          5 kB
        3. jdk8218194d.patch
          9 kB

            bsrbnd Bernard Blaser
            tvaleev Tagir Valeev
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: