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

static final fields without initializer are accepted by javac

    XMLWordPrintable

Details

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

    Backports

      Description

        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

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                  Created:
                  Updated:
                  Resolved: