In-depth understanding of Java Virtual Machine Notes---Method table collection

Source: Internet
Author: User

the structure of the method table is the same as the field table, which in turn contains the access flag (access_flags), the name Index (NAME_INDEX), the descriptor Index (DESCRIPTOR_INDEX), and several items of the property sheet collection (attributes), as shown in the following table:

Because the volatile keyword and the transient keyword cannot modify the method, the Acc_volatile and acc_transient flags are not in the access flags of the method table. In contrast, the synchronized, native, STRICTFP, and abstract keywords can be modified, so the method table's access flags add ACC_SYNCHRONIZED,ACC_NATIVE,ACC_STRICTFP, Acc_abstract logo. For the method table, all flag bits and values are as follows:

The Java code inside the method is stored in a property sheet named "Cocde" in the collection of method attribute tables, which is the most extensible data item in the class file bridge, after the compiler compiles the bytecode instruction.

corresponding to the Field table collection, the method of the parent class does not appear in the Method table collection if the parent method is not overridden (override) in the child class. But similarly, methods that are automatically added by the compiler may appear, most typically the class constructor "<client>" method and the default instance constructor "<init>" method. In the Java language, to override a method in addition to having the same simple name as the original method, it is required to have a signature that is different from the original method, which is a collection of field symbol references in the constant pool for each parameter in a method. That is, because the return value is not wrapped in signature signatures, because the Java language is unable to overload an existing method simply by relying on the difference in the return value. However, in the class file format, signature signatures are larger in scope, as long as the descriptor is not exactly the same two methods can coexist. That is, if two methods have the same name and signature, but the return value is different, it is also possible to legally coexist in the same class file.

In-depth understanding of Java Virtual Machine Notes---method table collection

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.