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

local records shouldn't capture any non-static state from any enclosing type

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 14
    • None
    • tools
    • b32

        test cases, provided by Tagir:

        class X {
          public static void main(String[] args) {
            int x = 2;
            record Y() {
              void test() {
                System.out.println(x);
              }
            }
            new Y().test();
          }
        }

        class X {
          public static void main(String[] args) {
            int x = 2;
            record Y() {
              static final int y = x;
            }
            new Y();
          }
        }

              vromero Vicente Arturo Romero Zaldivar
              vromero Vicente Arturo Romero Zaldivar
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: