JVM学习笔记-类型信息(Type Information)
For each type it loads, a Java Virtual Machine must store the following kinds of information in the method area:
对每个装载的类型,虚拟机都会在方法区中存储以下类型信息:
- The fully qualified name of the type
- 这个类型的全限定名
- The fully qualified name of the type’s direct superclass (unless the type is an interface or class java.lang.Object, neither of which have a superclass)
- 这个类型的直接超类的全限定名(除非这个类是java.lang.Object,它没有超类)。
- Whether or not the type is a class or an interface
- 这个类型是类类型还是接口类型
- The typeís modifiers ( some subset of` public, abstract, final)
- 这个类型的访问修饰符(public, abstract或final的某个子集)。
- An ordered list of the fully qualified names of any direct superinterfaces
- 任何直接超接口的全限定名的有序列表
Inside the Java class file and Java Virtual Machine, type names are always stored as fully qualified names. In Java source code, a fully qualified name is the name of a typeís package, plus a dot, plus the typeís simple name. For example, the fully qualified name of class Object in package java.lang is java.lang.Object. In class files, the dots are replaced by slashes, as in java/lang/Object. In the method area, fully qualified names can be represented in whatever form and data structures a designer chooses.
在Java class文件和虚拟机中,类型名总是以全限定名出现。在Java源代码中,全限定名由类所属包的名称加一个“.”,再加上类名组成。例如,类Object的所属包为java.lang,那么它的全限定名应该是java.lang.Object,但在class文件里,所有的“.” 都被斜杠“/”代替,这样就成为java/lang/Object。至于全限定名在方法区中的表示,则因不同的设计者有不同的选择而不同,可以用任何形式和数据结构来表示。
In addition to the basic type information listed above, the virtual machine must also store for each loaded type:
除了上面列出的基本类型信息外,虚拟机还得为每个被装载的类型存储以下信息:
- The constant pool for the type
- 该类型的常量池
- Field information
- 字段信息
- Method information
- 方法信息
- All class (static) variables declared in the type, except constants
- 除了常量以外的所有类(静态)变量
- A reference to class ClassLoader
- 一个到类CLassLoader的引用
- A reference to class Class
- 一个到Class类的引用
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· 单线程的Redis速度为什么快?
2018-01-16 java递归排序