`

JVM学习笔记-属性格式(Attributes Types)

 
阅读更多

 

Attributes

The Java Virtual Machine specification defines eight types of attributes, shown in Table 6-25. All Java Virtual Machine implementations must recognize three of these attributes: Code, ConstantValue, and Exceptions. Implementations can choose whether to recognize or ignore the other predefined attributes. (The InnerClasses and Synthetic attributes were added in Java 1.1). All of these predefined attributes are described in detail later in this chapter.

如表6-24所示,Java虚拟机规范定义了8种属性(实际上是9种)。为了正确地解释Javaclass文件,所有Java虚拟机实现都必须能够识别下列三种属性:Code,ConstantValue和Exception。为了正确地实现Java和Java 2 平台类库,虚拟机实现必须能够识别InnerClasses和Synthetic属性,但可以自主选择究竟是识别还是忽略其他一些与定义的属性(在Java1.1中,加入了Deprecated、InnerClasses和Synthetic属性(attribute))。所有这些预定义的属性将在本章详细阐述。

 

Table 6-25. Types of attribute_info tables defined by the specification

Name Used By Description
Code method_info The bytecodes and other data for one method
ConstantValue field_info

The value of a final variable

 

Deprecated field_info、method_info The fields and methods are discouraged from using
Exceptions method_info The checked exceptions that a method may throw
InnerClasses ClassFile A description of the inner classes defined inside a class
LineNumberTable Code_attribute A mapping of line numbers to bytecodes for one method
LocalVariableTable Code_attribute A description of the local variables for one method
SourceFile ClassFile The name of the source file
Synthetic field_info, method_info An indicator that a field or method was generated by the compiler

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics