Previous: Fields Data Structure, Up: The Class File Format


3.3 Methods Data Structure

The methods data structure is an array of method structure items. Each item consists of:

The last item is an array of additional attributes that provide additional information about the method. Each Java Virtual Machine should recognize the attributes Code, Exceptions, and Synthetic. Every method which is not abstract or native must have exactly one Code attribute (otherwise zero).

BML-related method attributes are described in Method Attributes.

3.3.1 Code Attribute

The structure of a method's Code attribute is as follows:

There is no requirement on a Java Virtual Machine to recognize any attributes in the attributes item above. A virtual machine may recognize for debugging and specification purposes the following code attributes: LineNumberTable, LocalVariableTable.

BML-related code attributes are described in Code Attributes.

3.3.2 LocalVariableTable Attribute

The LocalVariableTable is an optional attribute of a method's Code attribute.

It may be used by debuggers to determine the value of a given local variable during the execution of a method. There may be more than one LocalVariableTable attribute in the Code attribute, but each local variable can be mentioned at most once. The order of LocalVariableTable attributes is unspecified.

The structure of each entry in the local variable table is as follows:

3.3.3 LineNumberTable Attribute

The LineNumberTable is an optional attribute of a method's Code attribute.

It may be used by debuggers to determine which part of the Java Virtual Machine code array corresponds to a given line number in the original source file. There may be more than one LineNumberTable attributes in the Code attribute, and their order is unspecified. Moreover, the mapping from code addresses to source lines does not have to be in a one-to-one correspondence.

The structure of each entry in the line number table is as follows: