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
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
- csr for
-
JDK-8344780 javac is not generating the ConstantValue attribute for non-final static fields
- Draft
- relates to
-
JDK-8298116 5.5: ConstantValue can initialize non-final fields
- Resolved