Access Flagsin the previous analysis of the class file's magic number, minor version number, major version number, constant pool entrance, constant pool, then after the constant pool ends, immediately after the two bytes represents the access flag (access_flages). This flag is used to identify some class or interface-level access information, including: Whether this class is an interface, is defined as a public type, is defined as an abstract type, and if it is a class, it is declared final, and so on.
The access flags and their meanings are as follows:
Flag Name |
Flag value |
Meaning |
Acc_public |
0x00 01 |
is public type |
Acc_final |
0x00 10 |
is declared final, only the class can set the |
Acc_super |
0x00 20 |
Whether to allow the use of the new semantics of invokespecial bytecode directives. |
Acc_interface |
0x02 00 |
Flag this is an interface |
Acc_abstract |
0x04 00 |
is an abstract type, the secondary flag value is true for interfaces or abstract classes, and other types are false |
Acc_synthetic |
0x10 00 |
Flag This class is not generated by user code |
Acc_annotation |
0x20 00 |
Flag this is an annotation |
Acc_enum |
0x40 00 |
Flag This is an enumeration |
Access_flages The CCP has two bytes (16 bits) can be used, no use of the logo for the requirements are all 0.
Next, continue to analyze the previous example:
Source:
class file:
In this diagram, after the constant pool, the access flags are analyzed.
The analysis of 0x00 01 and 0x00 20 is through the above access to the sign table, corresponding to the Acc_public and Acc_super. Since only the two flag bits are 1, the other flag bits are 0, the values of each flag and the value of the flag itself are followed, and then the value of the entire access flag can be calculated. 0x00 01 | 0x00 = 0x00 21.
jvm-Access Flag