Java get method parameter name list

Source: Internet
Author: User

The premise of the following problems is to retain

1. method 1

Analyze the Class byte code structure to find out the location of the method-related information. We recommend that you use the jclasslib tool.

But if you just want to get the parameter name of the method, you don't have to study it. Because Wendal has been implemented. DetailsCodeIn

Https://gist.github.com/2011728

During my usage, I found that the class file compiled with eclipse can be correctly parsed, but the class file compiled with javac cannot be correctly parsed. Why? In fact, I still don't know that the two compilation results are different. Large .. As instructed by Wendal, the variable sequence obtained by the class file generated by javac is incorrect and is sorted by the use order of the variables. How can we get the sequence defined by a variable. I used jclasslib to observe and find a new one.Localvariabletable has an index attribute, Which is sorted in the correct order. The modified code is in

Https://gist.github.com/2011836

2. method 2

Use open-source tools such as ASM and other powerful bytecode operation tools.

The code is implemented in

Https://gist.github.com/2419358

This article is original by the author. For more information, see the source and share my happiness with you.
Http://www.cnblogs.com/weirhp

Related Article

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.