module Attribute: sig
.. end
Attributes in both low- and high-level forms.
It also provides conversion functions between levels as well as i/o
functions for low-level.
type
info = {
}
Represents an attribute as defined in the class file format specification.
Exception
type
error =
| |
Invalid_code_attribute |
| |
Invalid_code_length |
| |
Defined_twice of string |
| |
Invalid_field_attribute |
| |
Invalid_method_attribute |
| |
Invalid_class_attribute |
| |
Invalid_package_attribute |
| |
Invalid_module_attribute |
| |
Invalid_constant_value |
| |
Invalid_enclosing_method |
| |
Invalid_local_variable_table |
| |
Invalid_local_variable_type_table |
| |
Invalid_list_length |
| |
Invalid_attribute_name_value |
| |
Invalid_exception_name |
| |
Invalid_exception |
| |
Invalid_inner_class |
| |
Invalid_outer_class |
| |
Invalid_signature |
| |
Invalid_source_file |
| |
Invalid_stack_map_frame |
| |
Invalid_stack_map_verification_type |
| |
Invalid_bootstrap_method_handle |
| |
Invalid_bootstrap_argument |
| |
Invalid_module |
| |
Invalid_module_dependency_kind |
| |
Missing_module_attribute |
exception Exception of error
val string_of_error : error -> string
I/O functions
val read_info : InputStream.t -> info
read_info st
reads an attribute from st
.
Raises InputStream.Exception
if an i/o error occurs.
val write_info : OutputStream.t -> info -> unit
write_info st a
writes an attribute a
onto st
.
Raises OutputStream.Exception
if an i/o error occurs.
type
constant_value =
| |
Long_value of int64 |
| |
Float_value of float |
| |
Double_value of float |
| |
Boolean_value of bool |
| |
Byte_value of int |
| |
Character_value of int |
| |
Short_value of int |
| |
Integer_value of int32 |
| |
String_value of Utils.UTF8.t |
Constant values used by ConstantValue attribute.
val equal_constant_value : constant_value -> constant_value -> bool
Equality over constant values.
val compare_constant_value : constant_value -> constant_value -> int
Comparison over constant values.
val hash_constant_value : constant_value -> int
Hash function over constant values.
type
verification_type_info =
| |
Top_variable_info |
| |
Integer_variable_info |
| |
Float_variable_info |
| |
Long_variable_info |
| |
Double_variable_info |
| |
Null_variable_info |
| |
Uninitialized_this_variable_info |
| |
Object_variable_info of [ `Array_type of Descriptor.array_type | `Class_or_interface of Name.for_class ] |
| |
Uninitialized_variable_info of Utils.u2 |
Verification types.
val equal_verification_type_info : verification_type_info -> verification_type_info -> bool
Equality over verification type informations.
val compare_verification_type_info : verification_type_info -> verification_type_info -> int
Comparison over verification type informations.
val hash_verification_type_info : verification_type_info -> int
Hash function over verification type informations.
type
stack_map_frame =
Stack map frame modifications.
val equal_stack_map_frame : stack_map_frame -> stack_map_frame -> bool
Equality over stack map frames.
val compare_stack_map_frame : stack_map_frame -> stack_map_frame -> int
Comparison over stack map frames.
val hash_stack_map_frame : stack_map_frame -> int
Hash function over stack map frames.
type
dependency_kind =
| |
Optional_dependency |
| |
Same_class_loader |
| |
Not_observable |
The kinds of module-to-module dependencies.
type
t = [ `AnnotationDefault of Annotation.element_value
| `BootstrapMethods of Bootstrap.method_specifier list
| `Code of code_value
| `ConstantValue of constant_value
| `Deprecated
| `EnclosingMethod of enclosing_method_value
| `Exceptions of Name.for_class list
| `InnerClasses of inner_class_element list
| `LineNumberTable of (Utils.u2 * Utils.u2) list
| `LocalVariableTable of local_variable_table_element list
| `LocalVariableTypeTable of local_variable_type_table_element list
| `Module of Utils.UTF8.t * Utils.UTF8.t
| `ModulePermits of (Utils.UTF8.t * Utils.UTF8.t) list
| `ModuleProvides of (Utils.UTF8.t * Utils.UTF8.t) list
| `ModuleRequires of
(Utils.UTF8.t * Utils.UTF8.t * dependency_kind) list
| `RuntimeInvisibleAnnotations of Annotation.t list
| `RuntimeInvisibleParameterAnnotations of Annotation.t list list
| `RuntimeInvisibleTypeAnnotations of Annotation.extended list
| `RuntimeVisibleAnnotations of Annotation.t list
| `RuntimeVisibleParameterAnnotations of Annotation.t list list
| `RuntimeVisibleTypeAnnotations of Annotation.extended list
| `Signature of signature
| `SourceDebugExtension of Utils.UTF8.t
| `SourceFile of Utils.UTF8.t
| `StackMapTable of stack_map_frame list
| `Synthetic
| `Unknown of Utils.UTF8.t * string ]
type
signature = [ `Class of Signature.class_signature
| `Field of Signature.field_type_signature
| `Method of Signature.method_signature ]
type
code_attribute = [ `LineNumberTable of (Utils.u2 * Utils.u2) list
| `LocalVariableTable of local_variable_table_element list
| `LocalVariableTypeTable of local_variable_type_table_element list
| `StackMapTable of stack_map_frame list
| `Unknown of Utils.UTF8.t * string ]
type
code_value = {
}
type
exception_table_element = {
}
type
inner_class_element = {
}
type
enclosing_method_value = {
}
type
local_variable_table_element = {
}
type
local_variable_type_table_element = {
}
val equal_signature : signature -> signature -> bool
Equality over signatures.
val compare_signature : signature -> signature -> int
Comparison over signatures.
val hash_signature : signature -> int
Hash function over signatures.
val equal_code_attribute : code_attribute -> code_attribute -> bool
Equality over code attributes.
val compare_code_attribute : code_attribute -> code_attribute -> int
Comparison over code attributes.
val hash_code_attribute : code_attribute -> int
Hash function over code attributes.
val equal_code_value : code_value -> code_value -> bool
Equality over code values.
val compare_code_value : code_value -> code_value -> int
Comparison over code values.
val hash_code_value : code_value -> int
Hash function over code values.
val equal_exception_table_element : exception_table_element ->
exception_table_element -> bool
Equality over exception table elements.
val compare_exception_table_element : exception_table_element -> exception_table_element -> int
Comparison over exception table elements.
val hash_exception_table_element : exception_table_element -> int
Hash function over exception table elements.
val equal_inner_class_element : inner_class_element -> inner_class_element -> bool
Equality over inner class elements.
val compare_inner_class_element : inner_class_element -> inner_class_element -> int
Comparison over inner class elements.
val hash_inner_class_element : inner_class_element -> int
Hash function over inner class elements.
val equal_enclosing_method_value : enclosing_method_value -> enclosing_method_value -> bool
Equality over enclosing method values.
val compare_enclosing_method_value : enclosing_method_value -> enclosing_method_value -> int
Comparison over enclosing method values.
val hash_enclosing_method_value : enclosing_method_value -> int
Hash function over enclosing method values.
val equal_local_variable_table_element : local_variable_table_element ->
local_variable_table_element -> bool
Equality over local variable table elements.
val compare_local_variable_table_element : local_variable_table_element ->
local_variable_table_element -> int
Comparison over local variable table elements.
val hash_local_variable_table_element : local_variable_table_element -> int
Hash function over local variable table elements.
val equal_local_variable_type_table_element : local_variable_type_table_element ->
local_variable_type_table_element -> bool
Equality over local variable type table elements.
val compare_local_variable_type_table_element : local_variable_type_table_element ->
local_variable_type_table_element -> int
Comparison over local variable type table elements.
val hash_local_variable_type_table_element : local_variable_type_table_element -> int
Hash function over local variable type table elements.
val equal : t -> t -> bool
Equality over attributes.
val compare : t -> t -> int
Comparison over attributes.
val hash : t -> int
Hash function over attributes.
type
for_field = [ `ConstantValue of constant_value
| `Deprecated
| `RuntimeInvisibleAnnotations of Annotation.t list
| `RuntimeInvisibleTypeAnnotations of Annotation.extended list
| `RuntimeVisibleAnnotations of Annotation.t list
| `RuntimeVisibleTypeAnnotations of Annotation.extended list
| `Signature of [ `Field of Signature.field_type_signature ]
| `Synthetic
| `Unknown of Utils.UTF8.t * string ]
Possible attributes for a field.
type
for_method = [ `AnnotationDefault of Annotation.element_value
| `Code of code_value
| `Deprecated
| `Exceptions of Name.for_class list
| `RuntimeInvisibleAnnotations of Annotation.t list
| `RuntimeInvisibleParameterAnnotations of Annotation.t list list
| `RuntimeInvisibleTypeAnnotations of Annotation.extended list
| `RuntimeVisibleAnnotations of Annotation.t list
| `RuntimeVisibleParameterAnnotations of Annotation.t list list
| `RuntimeVisibleTypeAnnotations of Annotation.extended list
| `Signature of [ `Method of Signature.method_signature ]
| `Synthetic
| `Unknown of Utils.UTF8.t * string ]
Possible attributes for a method.
type
for_class = [ `BootstrapMethods of Bootstrap.method_specifier list
| `Deprecated
| `EnclosingMethod of enclosing_method_value
| `InnerClasses of inner_class_element list
| `Module of Utils.UTF8.t * Utils.UTF8.t
| `RuntimeInvisibleAnnotations of Annotation.t list
| `RuntimeInvisibleTypeAnnotations of Annotation.extended list
| `RuntimeVisibleAnnotations of Annotation.t list
| `RuntimeVisibleTypeAnnotations of Annotation.extended list
| `Signature of [ `Class of Signature.class_signature ]
| `SourceDebugExtension of Utils.UTF8.t
| `SourceFile of Utils.UTF8.t
| `Synthetic
| `Unknown of Utils.UTF8.t * string ]
Possible attributes for a class.
type
for_package = [ `Module of Utils.UTF8.t * Utils.UTF8.t
| `RuntimeInvisibleAnnotations of Annotation.t list
| `RuntimeVisibleAnnotations of Annotation.t list
| `SourceFile of Utils.UTF8.t
| `Unknown of Utils.UTF8.t * string ]
Possible attributes for a package.
type
for_module = [ `Module of Utils.UTF8.t * Utils.UTF8.t
| `ModulePermits of (Utils.UTF8.t * Utils.UTF8.t) list
| `ModuleProvides of (Utils.UTF8.t * Utils.UTF8.t) list
| `ModuleRequires of
(Utils.UTF8.t * Utils.UTF8.t * dependency_kind) list
| `RuntimeInvisibleAnnotations of Annotation.t list
| `RuntimeVisibleAnnotations of Annotation.t list
| `SourceFile of Utils.UTF8.t
| `Unknown of Utils.UTF8.t * string ]
Possible attributes for a module.
type
enclosing_element =
| |
Class |
| |
Method |
| |
Field |
| |
Package |
| |
Module |
Kinds of elements.
Conversion functions
val string_of_verification_type_info : verification_type_info -> string
Converts the passed verification type information into a string.
val verification_type_info_of_parameter_descriptor : Descriptor.for_parameter -> verification_type_info
Converts the passed descriptor into a verification type information.
val check_code_attributes : t list -> code_attribute list
Checks that the passed list is a valid one for a code attribute.
The list is returned if it is valid, raising Exception
otherwise.
val check_field_attributes : t list -> for_field list
Checks that the passed list is a valid one for a field.
The list is returned if it is valid, raising Exception
otherwise.
val check_method_attributes : t list -> for_method list
Checks that the passed list is a valid one for a method.
The list is returned if it is valid, raising Exception
otherwise.
val check_class_attributes : t list -> for_class list
Checks that the passed list is a valid one for a class.
The list is returned if it is valid, raising Exception
otherwise.
val check_package_attributes : t list -> for_package list
Checks that the passed list is a valid one for a package.
The list is returned if it is valid, raising Exception
otherwise.
val check_module_attributes : t list -> for_module list
Checks that the passed list is a valid one for a module.
The list is returned if it is valid, raising Exception
otherwise.
val decode : enclosing_element ->
Bootstrap.methods -> ConstantPool.t -> info -> t
Converts from a low-level into a high-level form according to passed pool,
and method bootstrap information.
Raises Exception
if an error occurs during conversion.
val encode : Bootstrap.methods -> ConstantPool.extendable -> t -> info
Converts from a high-level into a low-level form, using passed pool.
Raises Exception
if an error occurs during conversion.
val compare_according_to_significance : t -> t -> int
Comparison over attributes, to be used for user-intended output.
val version_bounds : t -> Version.bounds
Returns the version bounds for the passed attribute.
: t list -> code_value
Returns the contents of the Code attribute from the passed list.
Raises Not_found
if no such attribute exists.
: t list -> Name.for_class list
Returns the contents of the Exceptions attribute from the passed
list.
Raises Not_found
if no such attribute exists.
: for_class list -> Signature.class_signature
Returns the contents of the Signature attribute from the passed
list.
Raises Not_found
if no such attribute exists.
: t list -> Bootstrap.method_specifier list
Returns the contents of the BootstrapMethods attribute from the
passed list.
Raises Not_found
if no such attribute exists.
: for_field list -> Signature.field_type_signature
Returns the contents of the Signature attribute from the passed
list.
Raises Not_found
if no such attribute exists.
: for_method list -> Signature.method_signature
Returns the contents of the Signature attribute from the passed
list.
Raises Not_found
if no such attribute exists.
: t list -> Annotation.t list
Returns the list of annotations from the passed list.
Returns the empty list if no such annotation exists.