RuntimeVisibleParameterAnnotations attribute
Runtime-visible annotations on each parameter of a method, as in @PathVariable("id") String id..
- Appears on
- method
- Since
- class file 49.0 (Java 5)
- javac writes it
- for runtime-visible annotations on parameters
- Needed by the JVM
- no: it is for the class libraries (reflection), compilers or tools
Layout
| Type | Field | What it holds |
|---|---|---|
u2 | attribute_name_index | a Utf8: "RuntimeVisibleParameterAnnotations" |
u4 | attribute_length | bytes after this field |
u1 | num_parameters | |
parameter_annotations[…] | parameter_annotations | for each parameter: num_annotations, annotations |
What it is for
Runtime-visible annotations on each parameter of a method, as in @PathVariable("id") String id.
How common it is
JDK 25.0.5's java.base has 7 RuntimeVisibleParameterAnnotations attributes, in 5 of its 7,391 classes (7 on methods).
A real one, byte by byte
From Annotations.class (compiled by javac 25), on method old:
| Offset | Bytes | Field | Value |
|---|---|---|---|
| 1394 | 18 bytes | RuntimeVisibleParameterAnnotations | |
| 1394 | 00 31 | attribute_name_index | #49 |
| 1396 | 00 00 00 0c | attribute_length | 12 |
| 1400 | 01 | num_parameters | 1 |
| 1401 | 11 bytes | parameter 0 | |
| 1401 | 00 01 | num_annotations | 1 |
| 1403 | 9 bytes | annotation 0 | @Annotations$Info(value="param") |
| 1403 | 00 18 | type_index | #24 |
| 1405 | 00 01 | num_element_value_pairs | 1 |
| 1407 | 00 19 73 00 32 | pair 0 |
Specification: JVMS §4.7, The RuntimeVisibleParameterAnnotations Attribute (Java SE 25).