You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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页)
![image](https://user-images.githubusercontent.com/3983683/187108714-3bd223cf-22f9-4c93-8427-aea1ef5265fc.png)
我在最新的 Java 虚拟机规范里看到了 ConstantValue 属性的相关介绍(具体位置是 4.7.2. The ConstantValue Attribute)
![image](https://user-images.githubusercontent.com/3983683/187108984-73c7bad8-9ab4-47bc-ad98-cacce6d60999.png)
我把关键的那句话复制过来了
从引文来看,用 ConstantValue 属性的值给字段赋值应该是发生在初始化(initialization)阶段(而非准备阶段),且其执行时间早于
<clinit>
The text was updated successfully, but these errors were encountered: