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

# 4.7.18. The `RuntimeVisibleParameterAnnotations` Attribute

The `RuntimeVisibleParameterAnnotations` attribute is a variable-length attribute in the `attributes` table of the `method_info` structure ([§4.6](4.6.md)). The `RuntimeVisibleParameterAnnotations` attribute stores run-time visible annotations on the declarations of formal parameters of the corresponding method.

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

The `RuntimeVisibleParameterAnnotations` attribute has the following format:

```
RuntimeVisibleParameterAnnotations_attribute {
    u2 attribute_name_index;
    u4 attribute_length;
    u1 num_parameters;
    {   u2         num_annotations;
        annotation annotations[num_annotations];
    } parameter_annotations[num_parameters];
}
```

The items of the `RuntimeVisibleParameterAnnotations_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 "`RuntimeVisibleParameterAnnotations`".

- **attribute_length**

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

- **num_parameters**

  The value of the `num_parameters` item gives the number of run-time visible parameter annotations represented by this structure.

  There is no assurance that this number is the same as the number of parameter descriptors in the method descriptor.

- **parameter_annotations[]**

  Each entry in the `parameter_annotations` table represents all of the run-time visible annotations on the declaration of a single formal parameter. Each `parameter_annotations` entry contains the following two items:

  - **num_annotations**

    The value of the `num_annotations` item indicates the number of run-time visible annotations on the declaration of the formal parameter corresponding to the `parameter_annotations` entry.

  - **annotations[]**

    Each entry in the `annotations` table represents a single run-time visible annotation on the declaration of the formal parameter corresponding to the `parameter_annotations` entry. The `annotation` structure is specified in [§4.7.16](4.7.16.md).

  The *i*'th entry in the `parameter_annotations` table may, but is not required to, correspond to the *i*'th parameter descriptor in the method descriptor ([§4.3.3](4.3.3.md)).

  For example, a compiler may choose to create entries in the table corresponding only to those parameter descriptors which represent explicitly declared parameters in source code. In the Java programming language, a constructor of an inner class is specified to have an implicitly declared parameter before its explicitly declared parameters (JLS §8.8.1), so the corresponding `<init>` method in a `class` file has a parameter descriptor representing the implicitly declared parameter before any parameter descriptors representing explicitly declared parameters. If the first explicitly declared parameter is annotated in source code, then a compiler may create `parameter_annotations[0]` to store annotations corresponding to the *second* parameter descriptor.
