The ModuleMainClass attribute is a fixed-length attribute in the attributes table of a ClassFile structure. The ModuleMainClass attribute indicates the main class of a module.
There may be at most one ModuleMainClass attribute in the attributes table of a ClassFile structure.
The ModuleMainClass attribute has the following format:
ModuleMainClass_attribute {
u2 attribute_name_index;
u4 attribute_length;
u2 main_class_index;
}
The items of the ModuleMainClass_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 representing the string "ModuleMainClass". -
attribute_length
The value of the
attribute_lengthitem is the length of the attribute excluding the initial six bytes. -
main_class_index
The value of the
main_class_indexitem must be a valid index into theconstant_pooltable. Theconstant_poolentry at that index must be aCONSTANT_Class_infostructure representing the binary name of the main class of the current module.