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

static final fields without initializer are accepted by javac

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 14
    • Component/s: tools
    • Labels:
    • Subcomponent:
    • Resolved In Build:
      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

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

                  Dates

                  Created:
                  Updated:
                  Resolved: