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

# 4.7.24. The `MethodParameters` Attribute

The `MethodParameters` attribute is a variable-length attribute in the `attributes` table of a `method_info` structure ([§4.6](4.6.md)). A `MethodParameters` attribute records information about the formal parameters of a method, such as their names.

There may be at most one `MethodParameters` attribute in the `attributes` table of a `method_info` structure.

The `MethodParameters` attribute has the following format:

```
MethodParameters_attribute {
    u2 attribute_name_index;
    u4 attribute_length;
    u1 parameters_count;
    {   u2 name_index;
        u2 access_flags;
    } parameters[parameters_count];
}
```

The items of the `MethodParameters_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 "`MethodParameters`".

- **attribute_length**

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

- **parameters_count**

  The value of the `parameters_count` item indicates the number of parameter descriptors in the method descriptor ([§4.3.3](4.3.3.md)) referenced by the `descriptor_index` of the attribute's enclosing `method_info` structure.

  This is not a constraint which a Java Virtual Machine implementation must enforce during format checking ([§4.8](4.8.md)). The task of matching parameter descriptors in a method descriptor against the items in the `parameters` array below is done by the reflection libraries of the Java SE Platform.

- **parameters[]**

  Each entry in the `parameters` array contains the following pair of items:

  - **name_index**

    The value of the `name_index` item must either be zero or a valid index into the `constant_pool` table.

    If the value of the `name_index` item is zero, then this `parameters` element indicates a formal parameter with no name.

    If the value of the `name_index` item is nonzero, the `constant_pool` entry at that index must be a `CONSTANT_Utf8_info` structure representing a valid unqualified name denoting a formal parameter ([§4.2.2](4.2.2.md)).

  - **access_flags**

    The value of the `access_flags` item is as follows:

    - **0x0010 (`ACC_FINAL`)**

      Indicates that the formal parameter was declared `final`.

    - **0x1000 (`ACC_SYNTHETIC`)**

      Indicates that the formal parameter was not explicitly or implicitly declared in source code, according to the specification of the language in which the source code was written (JLS §13.1). (The formal parameter is an implementation artifact of the compiler which produced this `class` file.)

    - **0x8000 (`ACC_MANDATED`)**

      Indicates that the formal parameter was implicitly declared in source code, according to the specification of the language in which the source code was written (JLS §13.1). (The formal parameter is mandated by a language specification, so all compilers for the language must emit it.)

The *i*'th entry in the `parameters` array corresponds to the *i*'th parameter descriptor in the enclosing method's descriptor. (The `parameters_count` item is one byte because a method descriptor is limited to 255 parameters.) Effectively, this means the `parameters` array stores information for all the parameters of the method. One could imagine other schemes, where entries in the `parameters` array specify their corresponding parameter descriptors, but it would unduly complicate the `MethodParameters` attribute.

The *i*'th entry in the `parameters` array may or may not correspond to the *i*'th type in the enclosing method's `Signature` attribute (if present), or to the *i*'th annotation in the enclosing method's parameter annotations.
