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

TypeFieldWhat it holds
u2attribute_name_indexa Utf8: "RuntimeVisibleParameterAnnotations"
u4attribute_lengthbytes after this field
u1num_parameters
parameter_annotations[…]parameter_annotationsfor 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:

OffsetBytesFieldValue
139418 bytesRuntimeVisibleParameterAnnotations
139400 31attribute_name_index#49
139600 00 00 0cattribute_length12
140001num_parameters1
140111 bytesparameter 0
140100 01num_annotations1
14039 bytesannotation 0@Annotations$Info(value="param")
140300 18type_index#24
140500 01num_element_value_pairs1
140700 19 73 00 32pair 0

Open in the viewer

Specification: JVMS §4.7, The RuntimeVisibleParameterAnnotations Attribute (Java SE 25).