---
spec: JVMS
title: "The Java Virtual Machine Specification"
edition: "Java SE 26 Edition"
java_version: 26
chapter: "Chapter 4. The class File Format"
section: "4.7.30"
heading: "4.7.30. The Record Attribute"
parent: "4.7. Attributes"
source: https://docs.oracle.com/javase/specs/jvms/se26/html/jvms-4.html#jvms-4.7.30
id: "4.7.30"
url: https://jvm.obfuscated.software/jvms/se26/4.7.30.html
raw: https://jvm.obfuscated.software/jvms/se26/4.7.30.md
---

# 4.7.30. The `Record` Attribute

The `Record` attribute is a variable-length attribute in the `attributes` table of a `ClassFile` structure ([§4.1](4.1.md)). 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_index` item must be a valid index into the `constant_pool` table. The `constant_pool` entry at that index must be a `CONSTANT_Utf8_info` structure ([§4.4.7](4.4.7.md)) representing the string "`Record`".

- **attribute_length**

  The value of the `attribute_length` item indicates the length of the attribute, excluding the initial six bytes.

- **components_count**

  The value of the `components_count` item indicates the number of entries in the `components` table.

- **components[]**

  Each entry in the `components` table specifies a record component of the current class, in the order the record components were declared. The `record_component_info` structure 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_info` structure are as follows:

  - **name_index**

    The value of the `name_index` item must be a valid index into the `constant_pool` table. The `constant_pool` entry at that index must be a `CONSTANT_Utf8_info` structure ([§4.4.7](4.4.7.md)) representing a valid unqualified name denoting the record component ([§4.2.2](4.2.2.md)).

  - **descriptor_index**

    The value of the `descriptor_index` item must be a valid index into the `constant_pool` table. The `constant_pool` entry at that index must be a `CONSTANT_Utf8_info` structure ([§4.4.7](4.4.7.md)) representing a field descriptor which encodes the type of the record component ([§4.3.2](4.3.2.md)).

  - **attributes_count**

    The value of the `attributes_count` item indicates the number of additional attributes of this record component.

  - **attributes[]**

    Each value of the `attributes` table must be an `attribute_info` structure ([§4.7](4.7.md)).

    A record component can have any number of optional attributes associated with it.

    The attributes defined by this specification as appearing in the `attributes` table of a `record_component_info` structure are listed in [Table 4.7-C](4.7.md).

    The rules concerning attributes defined to appear in the `attributes` table of a `record_component_info` structure are given in [§4.7](4.7.md).

    The rules concerning non-predefined attributes in the `attributes` table of a `record_component_info` structure are given in [§4.7.1](4.7.1.md).
