The NestHost attribute is a fixed-length attribute in the attributes table of a ClassFile structure. The NestHost attribute records the nest host of the nest to which the current class or interface claims to belong (§5.4.4).
There may be at most one NestHost attribute in the attributes table of a ClassFile structure.
The NestHost attribute has the following format:
NestHost_attribute {
u2 attribute_name_index;
u4 attribute_length;
u2 host_class_index;
}
The items of the NestHost_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 "NestHost". -
attribute_length
The value of the
attribute_lengthitem must be two. -
host_class_index
The value of the
host_class_indexitem must be a valid index into theconstant_pooltable. Theconstant_poolentry at that index must be aCONSTANT_Class_infostructure (§4.4.1) representing a class or interface which is the nest host for the current class or interface.If the nest host cannot be loaded, or is not in the same run-time package as the current class or interface, or does not authorize nest membership for the current class or interface, then an error may occur during access control (§5.4.4).