3 The Class File Format
This chapter recapitulates the Java Virtual Machine class file
format. Each class file contains the definition of a single class or
interface. The official description of the class file format is given
in
Chapter 4 of The Java Virtual Machine Specification
[Lindholm-Yellin]. This chapter gives only an overview, in order to
give a comprehensive description of where the BML specifications are
stored.
A class file contains the following items:
- magic number
- file format version number
- constant pool, see Constant Pool,
- access flags (public, final, interface, abstract)
- class name (index in the constant pool)
- super class name (index in the constant pool)
- interfaces implemented by this (indexes in the constant pool)
- fields data structure, Fields Data Structure
- methods data structure, Methods Data Structure
- class attributes
The last item is an array of atributes that describe additional
information associated with a class file. A standard Java Virtual
Machine recognizes attributes SourceFile and Deprecated. BML-related
class attributes, such as class specifications, declarations of ghost
fields etc. and the
second constant pool that contains all specification-only
constants, are described in Class Attributes.