跳至主要內容
  • Hostloc 空間訪問刷分
  • 售賣場
  • 廣告位
  • 賣站?

4563博客

全新的繁體中文 WordPress 網站
  • 首頁
  • 我对 JVM 的 Loading Constraints 理解正确吗?
未分類
12 9 月 2020

我对 JVM 的 Loading Constraints 理解正确吗?

我对 JVM 的 Loading Constraints 理解正确吗?

資深大佬 : JasonLaw 7

Java Virtual Machine Specification – Chapter 5. Loading, Linking, and Initializing – 5.3. Creation and Loading – 5.3.4. Loading Constraints介绍了 Loading Constraints 。

假设有如下代码:

class Cat {     public static void main(String[] args) {         System.out.println(Mouse.ct);     } } 
class Mouse {     public static final CustomType ct = new CustomType(); } 
class CustomType {} 

Cat使用了Mouse.ct,所以它的常量池会包含指向CustomType的一个 symbolic reference 。Mouse定义了public static final CustomType ct,所以它的常量池也会包含指向CustomType的一个 symbolic reference 。

我理解的 Loading Constraints 是:如果 class loader L1 发起对Cat的加载,class loader L2发起对Mouse的加载。关于两者常量池中都包含的指向CustomType的 symbolic reference,最后要保证 L1 和 L2 所获得的 java.lang.Class instance 是同一个,而且 java.lang.Class instance 所关联的 method area 中的类型信息也是同一个。

请问我的理解正确吗?

大佬有話說 (0)

文章導覽

上一篇文章
下一篇文章

AD

其他操作

  • 登入
  • 訂閱網站內容的資訊提供
  • 訂閱留言的資訊提供
  • WordPress.org 台灣繁體中文

51la

4563博客

全新的繁體中文 WordPress 網站
返回頂端
本站採用 WordPress 建置 | 佈景主題採用 GretaThemes 所設計的 Memory
4563博客
  • Hostloc 空間訪問刷分
  • 售賣場
  • 廣告位
  • 賣站?
在這裡新增小工具