Java class 文件结构(Version-java8)

2019-01-16  本文已影响0人  MicoCube
类型 名称 数量 描述
u4 magic 1 魔数
u2 minor_version 1 次版本号
u2 major_version 1 主版本号
u2 constant_pool_count 1 常量池容量
cp_info constant_pool costant_pool_count-1 常量池
u2 access_flags 1 访问标志
u2 this_class 1 当前类常量索引
u2 super_class 1 超类常量索引
u2 interfaces_count 1 接口数量
u2 interfaces interfaces_count 接口常量索引
u2 fields_count 1 字段数量
field_info fields fields_count 字段信息
u2 methods_count 1 方法数量
method_info methods methods_count 方法信息
u2 attributes_count 1 属性数量
attribute_info attributes attributes_count 属性信息

说明:u代表字长,u4代表四个字节,以此类推,
由于不包含任何分隔符,故表中的数据项,无论是数量还是顺序,都是被严格限定的。哪个字节代表什么含义,长度是多少,先后顺序如何,都不允许改变

类型描述符
Attribute Location class file
SourceFile ClassFile 45.3
InnerClasses ClassFile 45.3
EnclosingMethod ClassFile 49.0
SourceDebugExtension ClassFile 49.0
BootstrapMethods ClassFile 51.0
ConstantValue field_info 45.3
Code method_info 45.3
Exceptions method_info 45.3
RuntimeVisibleParameterAnnotations,RuntimeInvisibleParameterAnnotations method_info 49.0
AnnotationDefault method_info 49.0
MethodParameters method_info 52.0
Synthetic ClassFile, field_info, method_info 45.3
Deprecated ClassFile, field_info, method_info 45.3
Signature ClassFile, field_info, method_info 49.0
RuntimeVisibleAnnotations, RuntimeInvisibleAnnotations ClassFile, field_info, method_info 49.0
LineNumberTable Code 45.3
LocalVariableTable Code 45.3
LocalVariableTypeTable Cod e 49.0
StackMapTable Code 50.0
RuntimeVisibleTypeAnnotations, RuntimeInvisibleTypeAnnotations ClassFile, field_info, method_info, Code 52.0
上一篇下一篇

猜你喜欢

热点阅读