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

No compilation error reported when record is declared in an inner class

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P3
    • None
    • None
    • tools

    Description

      The below code should throw a compilation error as record is declared in an inner class. However, the compilation goes through successfully.

      class Outer {
                      class Inner {
                                      record R(int a) {}
                      }
      }

      class RecordsTest {

                      public static void main(String[] args) {
                                      Outer.Inner.R rec = new Outer.Inner.R(1);
                                      System.out.println(rec.a());
                      }
      }

      Attachments

        Activity

          People

            vromero Vicente Arturo Romero Zaldivar
            vkhatri Vinod Khatri
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: