LocalVariableTable
attribute of the method, if a class is compiled with debug symbols on (i.e., javac -g). The LocalVariableTable
attribute is not accessible using reflection, but it can be read using the bytecode parsing library like ASM.javac -g
).Method
or Constructor
to the static method Paramo#resolveParameters
. It returns MethodParameter[]
array with method parameter information, or an empty array if the method/constructor does not have any parameter.MethodParameter
is a simple POJO that holds two information about the method parameter:resolveParameters
does not cache anything; every time invoked it will examine the bytecode again. For efficient usage, wrap it and cache results. {: .attn}Method
s and Constructor
using reflection (and with tool such ReflectUtil#findMethod
). Now, let's read parameter names: