The RuntimeVisibleParameterAnnotations attribute is a variable-length attribute in the attributes table of the method_info structure (§4.6). The RuntimeVisibleParameterAnnotations attribute records run-time visible annotations on the declarations of formal parameters of the corresponding method. The Java Virtual Machine must make these annotations available so they can be returned by the appropriate reflective APIs.
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_indexitem must be a valid index into theconstant_pooltable. Theconstant_poolentry at that index must be aCONSTANT_Utf8_infostructure (§4.4.7) representing the string "RuntimeVisibleParameterAnnotations". -
attribute_length
The value of the
attribute_lengthitem indicates the length of the attribute, excluding the initial six bytes. -
num_parameters
The value of the
num_parametersitem gives the number of formal parameters of the method represented by themethod_infostructure on which the annotation occurs.This duplicates information that could be extracted from the method descriptor.
-
parameter_annotations[]
Each entry in the
parameter_annotationstable represents all of the run-time visible annotations on the declaration of a single formal parameter. The i'th entry in the table corresponds to the i'th formal parameter in the method descriptor (§4.3.3). Eachparameter_annotationsentry contains the following two items:-
num_annotations
The value of the
num_annotationsitem indicates the number of run-time visible annotations on the declaration of the formal parameter corresponding to theparameter_annotationsentry. -
annotations[]
Each entry in the
annotationstable represents a single run-time visible annotation on the declaration of the formal parameter corresponding to theparameter_annotationsentry. Theannotationstructure is specified in §4.7.16.
-