The Record attribute is a variable-length attribute in the attributes table of a ClassFile structure (§4.1). The Record attribute indicates that the current class is a record class (JLS §8.10), and stores information about the record components of the record class (JLS §8.10.1).
There may be at most one Record attribute in the attributes table of a ClassFile structure.
The Record attribute has the following format:
Record_attribute {
u2 attribute_name_index;
u4 attribute_length;
u2 components_count;
record_component_info components[components_count];
}
The items of the Record_attribute structure are as follows:
-
attribute_name_index
The value of the
attribute_name_indexitem must be a valid index into theconstant_pooltable. Theconstant_poolentry at that index must be aCONSTANT_Utf8_infostructure (§4.4.7) representing the string "Record". -
attribute_length
The value of the
attribute_lengthitem indicates the length of the attribute, excluding the initial six bytes. -
components_count
The value of the
components_countitem indicates the number of entries in thecomponentstable. -
components[]
Each entry in the
componentstable specifies a record component of the current class, in the order the record components were declared. Therecord_component_infostructure has the following format:record_component_info { u2 name_index; u2 descriptor_index; u2 attributes_count; attribute_info attributes[attributes_count]; }The items of the
record_component_infostructure are as follows:-
name_index
The value of the
name_indexitem must be a valid index into theconstant_pooltable. Theconstant_poolentry at that index must be aCONSTANT_Utf8_infostructure (§4.4.7) representing a valid unqualified name denoting the record component (§4.2.2). -
descriptor_index
The value of the
descriptor_indexitem must be a valid index into theconstant_pooltable. Theconstant_poolentry at that index must be aCONSTANT_Utf8_infostructure (§4.4.7) representing a field descriptor which encodes the type of the record component (§4.3.2). -
attributes_count
The value of the
attributes_countitem indicates the number of additional attributes of this record component. -
attributes[]
Each value of the
attributestable must be anattribute_infostructure (§4.7).A record component can have any number of optional attributes associated with it.
The attributes defined by this specification as appearing in the
attributestable of arecord_component_infostructure are listed in Table 4.7-C.The rules concerning attributes defined to appear in the
attributestable of arecord_component_infostructure are given in §4.7.The rules concerning non-predefined attributes in the
attributestable of arecord_component_infostructure are given in §4.7.1.
-