读书人

JVM学习札记-属性格式(Attributes Typ

发布时间: 2012-10-24 14:15:58 作者: rapoo

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

NameUsed ByDescriptionCodemethod_infoThe bytecodes and other data for one methodConstantValuefield_info

The value of a final variable

?

Deprecatedfield_info、method_infoThe fields and methods are discouraged from usingExceptionsmethod_infoThe checked exceptions that a method may throwInnerClassesClassFileA description of the inner classes defined inside a classLineNumberTableCode_attributeA mapping of line numbers to bytecodes for one methodLocalVariableTableCode_attributeA description of the local variables for one methodSourceFileClassFileThe name of the source fileSyntheticfield_info, method_infoAn indicator that a field or method was generated by the compiler

?

读书人网 >编程

热点推荐