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

static final fields without initializer are accepted by javac

XMLWordPrintable

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

        this code is accepted by javac:

        record Test() {
          static final int x;

          public static void main(String[] args) {
            System.out.println(x);
          }
        }

        if we change `record Test()` for `class Test` then it is rejected

        reported by Tagir in amber-dev

              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: