module JClass:sig
..end
High level Ocaml representation of a Java class file.
typeaccess =
[ `Default | `Private | `Protected | `Public ]
Visibility modifiers.
type
attributes = {
|
synthetic : |
(* | correspond to the attribute, not to the flag (cf. JVM Spec se8 table 4.7-C and §4.7.8) | *) |
|
deprecated : |
|||
|
other : |
Generic attributes common to classes, fields and methods.
type
visibility =
| |
RTVisible |
| |
RTInvisible |
visibility modifiers for annotations. An annotation may either be visible at
run-time (RTVisible
) or only present in the class file without being
visible at run-time (RTInvisible
). (Note that there exists a third
visibility at the Java source level, but as it corresponds to the
source-only visibility they are not in the class file anymore.)
type
field_kind =
| |
NotFinal |
| |
Final |
| |
Volatile |
typeconstant_attribute =
[ `Double of float
| `Float of float
| `Int of int32
| `Long of int64
| `String of JBasics.jstr ]
type
class_field = {
|
cf_signature : |
|||
|
cf_class_signature : |
|||
|
cf_generic_signature : |
|||
|
cf_access : |
|||
|
cf_static : |
|||
|
cf_synthetic : |
(* | correspond to the flag ACC_SYNTHETIC, not to the Attribute (cf. JVM Spec se8 table 4.5-A) | *) |
|
cf_enum : |
|||
|
cf_kind : |
|||
|
cf_value : |
(* | Only if the field is static final. | *) |
|
cf_transient : |
|||
|
cf_annotations : |
|||
|
cf_other_flags : |
|||
|
cf_attributes : |
type
interface_field = {
|
if_signature : |
|||
|
if_class_signature : |
|||
|
if_generic_signature : |
|||
|
if_synthetic : |
(* | correspond to the flag ACC_SYNTHETIC, not to the Attribute (cf. JVM Spec se8 table 4.5-A) | *) |
|
if_value : |
(* | a constant_attribute is not mandatory, especially as it can be initialized by the class initializer <clinit>. | *) |
|
if_annotations : |
|||
|
if_other_flags : |
|||
|
if_attributes : |
Fields of interfaces are implicitly public
, static
and
final
.
type
any_field =
| |
InterfaceField of |
| |
ClassField of |
type 'a
implementation =
| |
Native |
| |
Java of |
type
method_annotations = {
|
ma_global : |
(* | annotations that are for the whole method. | *) |
|
ma_parameters : |
(* |
| *) |
type
method_parameter_attribute = {
|
mp_name : |
|
mp_final : |
|
mp_synthetic : |
|
mp_mandated : |
Attribute proper to a method parameter.
type 'a
concrete_method = {
|
cm_signature : |
|||
|
cm_class_method_signature : |
|||
|
cm_static : |
|||
|
cm_final : |
|||
|
cm_synchronized : |
|||
|
cm_strict : |
|||
|
cm_access : |
|||
|
cm_generic_signature : |
|||
|
cm_bridge : |
|||
|
cm_varargs : |
|||
|
cm_synthetic : |
(* | correspond to the flag ACC_SYNTHETIC, not to the Attribute (cf. JVM Spec se8 table 4.6-A) | *) |
|
cm_other_flags : |
|||
|
cm_exceptions : |
|||
|
cm_attributes : |
|||
|
cm_parameters : |
|||
|
cm_annotations : |
|||
|
cm_implementation : |
type
abstract_method = {
|
am_signature : |
|||
|
am_class_method_signature : |
|||
|
am_access : |
|||
|
am_generic_signature : |
|||
|
am_bridge : |
|||
|
am_varargs : |
|||
|
am_synthetic : |
(* | correspond to the flag ACC_SYNTHETIC, not to the Attribute (cf. JVM Spec se8 table 4.6-A) | *) |
|
am_other_flags : |
|||
|
am_exceptions : |
|||
|
am_attributes : |
|||
|
am_parameters : |
|||
|
am_annotations : |
|||
|
am_annotation_default : |
(* | If the method is in an annotation interface, then | *) |
type 'a
jmethod =
| |
AbstractMethod of |
| |
ConcreteMethod of |
type
inner_class = {
|
ic_class_name : |
|||
|
ic_outer_class_name : |
|||
|
ic_source_name : |
|||
|
ic_access : |
|||
|
ic_static : |
|||
|
ic_final : |
|||
|
ic_synthetic : |
|||
|
ic_annotation : |
(* |
| *) |
|
ic_enum : |
|||
|
ic_other_flags : |
|||
|
ic_type : |
type 'a
jclass = {
|
c_name : |
|||
|
c_version : |
|||
|
c_access : |
|||
|
c_final : |
|||
|
c_abstract : |
|||
|
c_super_class : |
|||
|
c_generic_signature : |
|||
|
c_fields : |
|||
|
c_interfaces : |
|||
|
c_consts : |
(* | the constant pool is at least needed for unparsed/unknown attributes that might refer to the constant pool. | *) |
|
c_sourcefile : |
|||
|
c_deprecated : |
|||
|
c_enclosing_method : |
(* | introduced with Java 5 for local classes (defined in methods' code). The first element is innermost class that encloses the declaration of the current class. The second element is the method that encose this class definition. cf JVM spec se8 table 4.7-C and §4.7.7. | *) |
|
c_source_debug_extention : |
(* | Introduced in Java 5 for debugging purpose (no semantics defined). cf JVM spec se8 table 4.7-C and §4.7.11. | *) |
|
c_inner_classes : |
|||
|
c_synthetic : |
(* | correspond to the flag ACC_SYNTHETIC, not to the Attribute (cf. JVM Spec se8 table 4.1-A) | *) |
|
c_enum : |
|||
|
c_annotations : |
|||
|
c_other_flags : |
|||
|
c_other_attributes : |
|||
|
c_methods : |
type 'a
jinterface = {
|
i_name : |
|||
|
i_version : |
|||
|
i_access : |
|||
|
i_interfaces : |
|||
|
i_generic_signature : |
|||
|
i_consts : |
(* | needed at least for unparsed/unknown attributes that might refer to the constant pool. | *) |
|
i_sourcefile : |
|||
|
i_deprecated : |
|||
|
i_source_debug_extention : |
(* | Introduced in Java 5 for debugging purpose (no semantics defined). cf JVM spec se8 table 4.7-C and §4.7.11. | *) |
|
i_inner_classes : |
|||
|
i_annotation : |
(* |
| *) |
|
i_annotations : |
|||
|
i_other_attributes : |
|||
|
i_other_flags : |
|||
|
i_fields : |
|||
|
i_methods : |
Interfaces cannot be final and can only contains abstract
methods. Their super class is java.lang.Object
.
type 'a
interface_or_class =
| |
JInterface of |
| |
JClass of |
val get_name : 'a interface_or_class -> JBasics.class_name
val get_consts : 'a interface_or_class -> JBasics.constant array
val get_access : 'a interface_or_class -> [ `Default | `Public ]
val get_sourcefile : 'a interface_or_class -> string option
val is_deprecated : 'a interface_or_class -> bool
val is_final : 'a interface_or_class -> bool
val get_inner_classes : 'a interface_or_class -> inner_class list
val get_other_attributes : 'a interface_or_class -> (string * string) list
val get_initializer : 'a interface_or_class -> 'a concrete_method option
val get_other_flags : 'a interface_or_class -> int list
val get_method_signature : 'a jmethod -> JBasics.method_signature
val get_class_method_signature : 'a jmethod -> JBasics.class_method_signature
val get_method_visibility : 'a jmethod -> access
val is_static_method : 'a jmethod -> bool
val is_final_method : 'a jmethod -> bool
val is_synchronized_method : 'a jmethod -> bool
val get_method : 'a interface_or_class -> JBasics.method_signature -> 'a jmethod
val get_concrete_method : 'a interface_or_class ->
JBasics.method_signature -> 'a concrete_method
val get_methods : 'a interface_or_class -> 'a jmethod JBasics.MethodMap.t
val get_concrete_methods : 'a interface_or_class -> 'a concrete_method JBasics.MethodMap.t
val defines_method : 'a interface_or_class -> JBasics.method_signature -> bool
val get_field_signature : any_field -> JBasics.field_signature
val get_class_field_signature : any_field -> JBasics.class_field_signature
val get_field_visibility : any_field -> access
val is_static_field : any_field -> bool
val is_final_field : any_field -> bool
val get_field : 'a interface_or_class -> JBasics.field_signature -> any_field
val get_fields : 'a interface_or_class -> any_field JBasics.FieldMap.t
val defines_field : 'a interface_or_class -> JBasics.field_signature -> bool
The following functions iterate over all fields of a class or interface.
val cf_iter : (class_field -> unit) -> 'a interface_or_class -> unit
val if_iter : (interface_field -> unit) -> 'a interface_or_class -> unit
val f_iter : (any_field -> unit) -> 'a interface_or_class -> unit
val cf_fold : (class_field -> 'b -> 'b) -> 'a interface_or_class -> 'b -> 'b
val if_fold : (interface_field -> 'b -> 'b) ->
'a interface_or_class -> 'b -> 'b
val f_fold : (any_field -> 'b -> 'b) -> 'a interface_or_class -> 'b -> 'b
val cm_iter : ('a concrete_method -> unit) -> 'a interface_or_class -> unit
The following functions iterate over all methods of a class or interface.
When iterating over concrete method, m_iter
, cm_iter
, m_fold
and
cm_fold
take passes the class initializer, if any, to their argument.
val am_iter : (abstract_method -> unit) -> 'a interface_or_class -> unit
val m_iter : ('a jmethod -> unit) -> 'a interface_or_class -> unit
val cm_fold : ('a concrete_method -> 'b -> 'b) ->
'a interface_or_class -> 'b -> 'b
val am_fold : (abstract_method -> 'b -> 'b) ->
'a interface_or_class -> 'b -> 'b
val m_fold : ('a jmethod -> 'b -> 'b) -> 'a interface_or_class -> 'b -> 'b
val map_concrete_method : ?force:bool ->
('a -> 'b) -> 'a concrete_method -> 'b concrete_method
val map_concrete_method_with_native : ('a implementation -> 'b implementation) ->
'a concrete_method -> 'b concrete_method
val map_class : ?force:bool -> ('a -> 'b) -> 'a jclass -> 'b jclass
val map_interface : ?force:bool -> ('a -> 'b) -> 'a jinterface -> 'b jinterface
val map_interface_or_class : ?force:bool ->
('a -> 'b) -> 'a interface_or_class -> 'b interface_or_class
val map_class_with_native : ('a implementation -> 'b implementation) ->
'a jclass -> 'b jclass
val map_interface_with_native : ('a implementation -> 'b implementation) ->
'a jinterface -> 'b jinterface
val map_interface_or_class_with_native : ('a implementation -> 'b implementation) ->
'a interface_or_class -> 'b interface_or_class
val map_class_context : ?force:bool ->
('a concrete_method -> 'a -> 'b) ->
'a jclass -> 'b jclass
val map_interface_context : ?force:bool ->
('a concrete_method -> 'a -> 'b) ->
'a jinterface -> 'b jinterface
val map_interface_or_class_context : ?force:bool ->
('a concrete_method -> 'a -> 'b) ->
'a interface_or_class -> 'b interface_or_class
val map_class_with_native_context : ('a concrete_method ->
'a implementation -> 'b implementation) ->
'a jclass -> 'b jclass
val map_interface_with_native_context : ('a concrete_method ->
'a implementation -> 'b implementation) ->
'a jinterface -> 'b jinterface
val map_interface_or_class_with_native_context : ('a concrete_method ->
'a implementation -> 'b implementation) ->
'a interface_or_class -> 'b interface_or_class
val remove_invokedynamic : JCode.jcode interface_or_class ->
JBasics.method_signature ->
int ->
prefix:string ->
JCode.jcode interface_or_class * JCode.jcode interface_or_class
val remove_invokedynamics_in_method : JCode.jcode interface_or_class ->
JBasics.method_signature ->
prefix:string ->
JCode.jcode interface_or_class *
JCode.jcode interface_or_class JBasics.ClassMap.t
val remove_invokedynamics : JCode.jcode interface_or_class ->
prefix:string ->
JCode.jcode interface_or_class *
JCode.jcode interface_or_class JBasics.ClassMap.t