Module Field

module Field: sig .. end
Fields in both low- and high-level forms.

It also provides conversion functions between levels as well as i/o functions for low-level.



Low-level form

type info = {
   access_flags :Utils.u2;
   name_index :Utils.u2;
   descriptor_index :Utils.u2;
   attributes_count :Utils.u2;
   attributes_array :Attribute.info array;
}
Represents a field as defined in the class file format specification.

Exception

type error = 
| Invalid_name of Utils.UTF8.t
| Invalid_name_value of Utils.u2
| Invalid_descriptor_value of Utils.u2
exception Exception of error
val string_of_error : error -> string

I/O functions

val read_info : InputStream.t -> info
read_info st reads a field from st. Raises InputStream.Exception if an i/o error occurs.
val write_info : OutputStream.t -> info -> unit
write_info st f writes field f onto st. Raises OutputStream.Exception if an i/o error occurs.

High-level form

type t = {
   flags :AccessFlag.for_field list;
   name :Name.for_field;
   descriptor :Descriptor.for_field;
   attributes :Attribute.for_field list;
}
Represents a field as defined in the Java language.
val equal : t -> t -> bool
Equality over fields.
val compare : t -> t -> int
Comparison over fields.
val hash : t -> int
Hash function over fields.
val compare_according_to_visibility : t -> t -> int
Comparison over fields, to be used to compare for user-intended output.

Conversion functions

val decode : bool -> ConstantPool.t -> info -> t
Converts from a low-level into a high-level form according to passed pool. The passed boolean indicates whether the enclosing element is an interface. Raises Exception if an error occurs during conversion.
val encode : ConstantPool.extendable -> t -> info
Converts from a high-level into a low-level form, using passed extendable pool. Raises Exception if an error occurs during conversion.