If the ACC_STATIC flag in the access_flags item of the field_info structure is set, then the field represented by the field_info structure is assigned the value represented by its ConstantValue attribute as part of the initialization of the class or interface declaring the field (§5.5). This occurs prior to the invocation of the class or interface initialization method of that class or interface (§2.9.2).
在 第3版 《深入理解Java虚拟机》一书的 7.3.3 “准备” 这一小节里,有和 ConstantValue 相关的描述 (在第272页)
我在最新的 Java 虚拟机规范里看到了 ConstantValue 属性的相关介绍(具体位置是 4.7.2. The ConstantValue Attribute)
我把关键的那句话复制过来了
从引文来看,用 ConstantValue 属性的值给字段赋值应该是发生在初始化(initialization)阶段(而非准备阶段),且其执行时间早于
<clinit>