访问静态字段与此类似。
类一旦被解析,就会以一种线程安全的方式修改原始代码位置以便直接访问静态字段的地址,因为此时已获知该地址。
Once the class has been resolved, the original code location is modified in a thread-safe way to access the static field's address directly because that address is then known.
这种做法并不常见,因为需要开发人员创建仅用于访问非实例(静态)方法和字段的对象的实例。
This is unusual because it requires a developer to create an instance of an object just to access non-instance (static) methods and fields!
应用推荐