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