Next: Field Attributes, Previous: Encoding of Modifiers, Up: Encoding of BML in Class File Format
The class attributes represent additional BML-entities added to a class
This attribute contains the version number of the BML specification annotations. The format of the attribute is as follows:
Version_attribute { u2 attribute_name_index; u4 attribute_length; u2 major; u2 minor; }
The meaning of the fields:
A major version number change indicates an incompatible change in the format of attributes. A minor version number change indicates a backward-compatible change, e.g., the addition of a new attribute or a new flag. This attribute can occur only once.
This attribute represents BML class modifiers. The format of the attribute is as follows:
ClassModifiers_attribute { u2 attribute_name_index; u4 attribute_length; u4 BML_flags; }
The meaning of the fields:
This attribute contains information about a class's ghost fields. The format of the attribute is as follows:
GhostField_attribute { u2 attribute_name_index; u4 attribute_length; u2 fields_count; { u2 access_flags; u4 BML_flags; u2 name_index; u2 descriptor_index; } fields[fields_count]; }
The meaning of the fields:
ACC_PUBLIC
, ACC_PROTECTED
,
ACC_PRIVATE
, ACC_FINAL
and ACC_STATIC
. Only one of ACC_PUBLIC
, ACC_PROTECTED
,
ACC_PRIVATE
can be set.
BML_NON_NULL
,
BML_NULLABLE
, BML_PEER
, BML_REP
,
BML_READONLY
, BML_ELEM_PEER
, BML_ELEM_READONLY
. All other flags must be cleared. Only one of BML_NON_NULL
,
BML_NULLABLE
can be set. Only one
of BML_PEER
, BML_REP
, BML_READONLY
can be set.
Only one of BML_ELEM_PEER
, BML_ELEM_READONLY
can be set only if
one of BML_PEER
, BML_REP
, BML_READONLY
is set and
the field is an array.
\TYPE
) is stored
The initial value of a ghost field must be set by a Set instruction in the static initializer (for static ghost fields) and constructors (for instance ghost fields). [JCh 20080312: do we allow more than one GhostField attribute? The same question is valid for: GhostField, ModelField, ModelMethod. BTW: Shouldn't they be given a plural name (e.g. GhostFields) ?]
This attribute contains information about a class's model fields. The format of the attribute is as follows:
ModelField_attribute { u2 attribute_name_index; u4 attribute_length; u2 fields_count; { u2 access_flags; u4 BML_flags; u2 name_index; u2 descriptor_index; } fields[fields_count]; }
The meaning of the fields:
ACC_PUBLIC
, ACC_PROTECTED
,
ACC_PRIVATE
and ACC_STATIC
. Only one of ACC_PUBLIC
, ACC_PROTECTED
,
ACC_PRIVATE
can be set.
BML_NON_NULL
,
BML_NULLABLE
, BML_PEER
, BML_REP
,
BML_READONLY
, BML_ELEM_PEER
, BML_ELEM_READONLY
. All other flags must be cleared. Only one of BML_NON_NULL
,
BML_NULLABLE
can be set. Only one
of BML_PEER
, BML_REP
, BML_READONLY
can be set.
Only one of BML_ELEM_PEER
, BML_ELEM_READONLY
can be set only if
one of BML_PEER
, BML_REP
, BML_READONLY
is set and
the field is an array.
\TYPE
) is stored
Represents clauses for model fields are stored in RepresentsClause Attributes, see Class Attributes.
This attribute contains information about the model methods declared in the class. The format of the attribute is as follows:
ModelMethod_attribute { u2 attribute_name_index; u4 attribute_length; u2 methods_count; method_info methods[methods_count]; }
The meaning of the fields is as follows:
method_info
structure (extended with BML-specific attributes), see
Methods Data Structure and Method Attributes. The BML flags
of model methods are stored in the MethodSpecification Attribute
(see Method Attributes). The only allowed flags are BML_NON_NULL
,
BML_NULLABLE
. All other flags must be cleared. Only one of BML_NON_NULL
,
BML_NULLABLE
can be set for any given method.
Note that model methods that are part of an interface do not have to be
static, like Java methods. This information is represented by the unset
ACC_STATIC
flag in the access_flags
attribute of the
method_info
structure of the given method.
This attribute describes the class invariants. It has the following structure:
ClassInvariant_attribute { u2 attribute_name_index; u4 attribute_length; u2 access_flags; formula_info invariant; }
The meaning of the fields is as follows:
ACC_PUBLIC
, ACC_PROTECTED
,
ACC_PRIVATE
and ACC_STATIC
. All other flags must be
cleared. Only one of ACC_PUBLIC
, ACC_PROTECTED
,
ACC_PRIVATE
can be set.
This attribute describes the history constraints of the class. It has the following structure:
Constraint_attribute { u2 attribute_name_index; u4 attribute_length; u2 access_flags; formula_info constraint; }
The meaning of the fields is as follows:
ACC_PUBLIC
, ACC_PROTECTED
,
ACC_PRIVATE
and ACC_STATIC
. Only one of
ACC_PUBLIC
, ACC_PROTECTED
, ACC_PRIVATE
can be
set. All other flags must be cleared.
This atribute represents an “initially” clause of a class. It is a condition that is supposed to hold right after the creation of the object, i.e. after the termination of any of it constructors. It has the following structure:
InitiallyClause_attribute { u2 attribute_name_index; u4 attribute_length; u2 access_flags; formula_info clause; }
The meaning of the fields is as follows:
ACC_PUBLIC
, ACC_PROTECTED
,
ACC_PRIVATE
and ACC_STATIC
. Only one of ACC_PUBLIC
, ACC_PROTECTED
,
ACC_PRIVATE
can be set.
This atribute describes a “represents” clause, saying what is the meaning of a particular model field. It has the following structure:
RepresentsClause_attribute { u2 attribute_name_index; u4 attribute_length; u2 access_flags; expression_info field; expression_info spec; }
The meaning of the fields is as follows:
ACC_PUBLIC
, ACC_PROTECTED
,
ACC_PRIVATE
and ACC_STATIC
. Only one of ACC_PUBLIC
, ACC_PROTECTED
,
ACC_PRIVATE
can be set.
The field must be an expression referering to a model field defined in the class or its superclass.
This attribute represents the second constant pool, containing all names and types that appear in the specification part of the class description. It has the following structure:
SecondConstantPool_attribute { u2 attribute_name_index; u4 attribute_length; u2 second_cp_count; cp_info second_cp[second_cp_count]; }
The meaning of the fields is as follows:
The structure of this attribute closely resembles the definition of the JVM constant pool structure. If a JVM constant pool is of size cp_count, then all references #n with n smaller than cp_count are references to the JVM constant pool, and references #n with n greater or equal than cp_count are references to a field in the second constant pool with index n-cp_count. References #n with n greater or equal to cp_count+second_cp_count are invalid. This attribute can occur only once.
This attribute contains information abous static (non-trivial) data groups defined in the class. The format of the attribute is as follows:
DataGroups_attribute { u2 attribute_name_index; u4 attribute_length; u2 groups_count; { u2 name_index; u2 access_flags; assignable_info members; } groups[groups_count]; }
The meaning of the fields:
ACC_PUBLIC
, ACC_PROTECTED
,
ACC_PRIVATE
and ACC_STATIC
. Only one of ACC_PUBLIC
, ACC_PROTECTED
,
ACC_PRIVATE
can be set.
[1] As mentioned above, in future extensions of BML, more advanced specification constructs, e.g., model classes, might require the use of class modifiers. Therefore, the attribute is defined anyway.