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

javac is not generating the ConstantValue attribute for non-final static fields

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P4 P4
    • tbd
    • 22, 23, 24
    • tools
    • None

      this text in section `5.5 Initialization` of the `JVMS21`:

          6. Otherwise, record the fact that initialization of the Class object for C is in
          progress by the current thread, and release LC .
          Then, initialize each final static field of C with the constant value in
          its ConstantValue attribute (§4.7.2), in the order the fields appear in the
          ClassFile structure.

      changed in `JVMS22` to:

          6. Otherwise, record the fact that initialization of the Class object for C is in
          progress by the current thread, and release LC .
          Then, initialize each static field of C with the constant value in its
          ConstantValue attribute (§4.7.2), in the order the fields appear in the
          ClassFile structure.

      see that in: `Then, initialize each static field of C` the mention to the fact that the field must also be `final` was dropped. Javac needs to catch up with this.

      Thanks to Dan Heidinga for reporting this issue

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

              Created:
              Updated: