The AnnotationDefault attribute is a variable-length attribute in the attributes table of certain method_info structures (§4.6), namely those representing elements of annotation types (JLS §9.6.1). The AnnotationDefault attribute records the default value (JLS §9.6.2) for the element represented by the method_info structure.
There may be at most one AnnotationDefault attribute in the attributes table of a method_info structure which represents an element of an annotation type.
The AnnotationDefault attribute has the following format:
AnnotationDefault_attribute {
u2 attribute_name_index;
u4 attribute_length;
element_value default_value;
}
The items of the AnnotationDefault_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 "AnnotationDefault". -
attribute_length
The value of the
attribute_lengthitem indicates the length of the attribute, excluding the initial six bytes. -
default_value
The
default_valueitem represents the default value of the annotation type element represented by themethod_infostructure enclosing thisAnnotationDefaultattribute.