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

No compilation error reported when a record is declared in a local class

    XMLWordPrintable

    Details

    • Subcomponent:
    • Resolved In Build:
      b34

      Backports

        Description

        The below code declares a record in a local class. It should throw a compilation error as nested record type is implicitly static and inner class cannot have static members except for constant variables. However, the compilation goes through successfully.

        class Outer {
            public void test() {
                class Inner extends Outer {
                    record TestRecord(int i, int j) {
                    }
                }
            }
        }

          Attachments

            Issue Links

              Activity

                People

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

                  Dates

                  Created:
                  Updated:
                  Resolved: