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

Diamond: compiler accepts erroneous code where diamond is used with non-generic inner class

    XMLWordPrintable

    Details

    • Subcomponent:
    • Resolved In Build:
      b138
    • CPU:
      unknown
    • OS:
      generic
    • Verification:
      Verified

      Description

      Compiler accepts the following code:

      class A<X> {
         class B { }

         B b = new B<>();
      }

      Moreover, error messages for the following code is misleading:

      class A<X> {
         class B { }

         B b = new A<>.B<>();
      }

      The above is rejected with:

      TestX.java:4: error: improperly formed type, type arguments given on a raw type
         B b = new A<>.B<>();
                        ^

      This should simply be a parser error.

        Attachments

          Activity

            People

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

              Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: