jvm-Access Flag

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.