As used herein only as a review list
Class structure
1. The numbers (1 to 4 bytes) Magic
fixed 0xCOFEBABE
2. version number (5-8 bytes)
5,6 Byte: a minor version number, JDK2 ~ JDK12 been zeroed
7,8 bytes : major version number, counting from the beginning 45
3. constant pool
index starting from a
9, 10-byte constant pool count value
followed by a constant table
4. access flag
5. the class index set
6. the parent index set
7. Interface index set
8. field set table
9. The method set table
More portions are arranged in the order
set of tables included in the above set of attributes
Constant pool contents
字面量
符号引用
JAVA class symbol understood by reference
constant pool CCP 17 kinds of types, each type is a beginning byte tag, you identify the type followed by several types of
types of P222 forms See
Access flag
This class of modifiers (final, public, abstract), types (classes, interfaces, annotations, enums, modules, etc.), whether generated by a user code (which may be added by JVM), invokespecial instruction whether to allow
a total of 9 bits Flag is available, see P224
Class Index
u2, often a point scale, represents a fully qualified class name of the
parent index, the same interface index, but the index is a collection of interfaces, the interface has a counter
Property sheet
Code属性 记录方法中的数据
Exception 方法抛出的异常(throws)
LineNumberTable 记录指令对应的java行号,非必须
LocalVariableTable 记录参数名,非必须,如果没有,代码调试会无法获取相关参数的值
LocalVariableTypeTable 用于泛型
SourceFile 源码文件名称
SourceDebugExtension 用于帮助非java文件(如jsp)的Debug
ConstantValue 用于static变量的初始化,javac追加限制 :final
InnerClasses 记录内部类与宿主类的关系
Deprecated 布尔属性,表示是否过时
Synthetic 布尔属性,表示是否有编译器自动生成
StackMapTable 用于虚拟机验证字节码
Signature 记录泛型相关信息,便于反射
BootstrapMethods
MethodParameter 记录方法的各个形参名称和信息
模块化相关属性
运行时注解
Variable slot
JVM smallest unit of memory allocation used for the local variables
Method class code length
No more than 65,535 instructions
Exception table
P237