New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add functions for getting the parameter names of method #357
Conversation
public String variableNameByIndex(int index) { | ||
for (int i = 0; i < tableLength(); i++) { | ||
if (index(i) == index) { | ||
return getConstPool().getUtf8Info(nameIndex(i)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Had better use variableName(i)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add unit tests.
* @param i the position of the parameter. | ||
*/ | ||
public String parameterName(int i) { | ||
return getConstPool().getUtf8Info(name(i)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add unit tests for the changes.
…hodParametersAttribute.parameterName
@NingZhang-e Thanks for review, I added unit tests. |
jboss-javassist/javassist#305 jboss-javassist/javassist#328 jboss-javassist/javassist#339 jboss-javassist/javassist#350 jboss-javassist/javassist#357 jboss-javassist/javassist#363 Change-Id: I29963013cf637731fe1064425b9d2e80d63bd9d3 Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
jboss-javassist/javassist#305 jboss-javassist/javassist#328 jboss-javassist/javassist#339 jboss-javassist/javassist#350 jboss-javassist/javassist#357 jboss-javassist/javassist#363 Change-Id: I29963013cf637731fe1064425b9d2e80d63bd9d3 Signed-off-by: Robert Varga <robert.varga@pantheon.tech> (cherry picked from commit 0df0ba3)
jboss-javassist/javassist#305 jboss-javassist/javassist#328 jboss-javassist/javassist#339 jboss-javassist/javassist#350 jboss-javassist/javassist#357 jboss-javassist/javassist#363 Change-Id: I29963013cf637731fe1064425b9d2e80d63bd9d3 Signed-off-by: Robert Varga <robert.varga@pantheon.tech> (cherry picked from commit 0df0ba3)
LocalVariableAttribute.java
for getting correct local variable name by given index. ThevariableName
method has some ambiguities for get the parameter names of method, see How to get method parameter names with javassist? #14 , Obtained incorrect original parameter name of method by MethodInfo API #16 , how to get the methd parameter name? #131 . Thelocal_variable_table
may appear in any order, sovariableName
method give incorrect value.MethodParametersAttribute.java
for getting parameter names.