Indeed, you can get the names of the arguments, but only if the code was compiled using debugging symbols, otherwise you cannot do it.
, . 4.7.13. LocalVariableTable jvm. , JVM , , !
ctmethod
CtMethod method = .....;
MethodInfo methodInfo = method.getMethodInfo();
LocalVariableAttribute table = methodInfo.getCodeAttribute().getAttribute(javassist.bytecode.LocalVariableAttribute.tag);
, table
.
int numberOfLocalVariables = table.tableLenght();
numberOfLocalVariables
:
- 1st: , , Length();
- 2nd: ,
this
.
:
|this (if non static) | arg1 | arg2 | ... | argN | var1 | ... | varN|
, , , arg2 , 3- . , :
int frameWithNameAtConstantPool = table.nameIndex(2);
String variableName = methodInfo.getConstPool().getUtf8Info(frameAtConstantPool)
variableName
.
. , (Java) Java-. , , paranamer. .
, !