Jordan Tan Jun Wen
Jordan Tan Jun Wen

Reputation: 45

get Javassist MethodInfo from Apache BCEL JavaClass

I recently wanted to make this github projectWhyline to use library instead of writing own code. This project has a javaagent and I am stucked in the whyline/tracing/ClassInstrumener.java class. So I found out that Apache BCEL and Javassist has classes that can replace existing code but I do not know how to replace this to fit the for loop

for (MethodInfo method : classfile.getDeclaredMethods()) {

classfile is an instance of org.apache.bcel.classfile.JavaClass but MethodInfo is an instance of javassist.bytecode.MethodInfo

Upvotes: 0

Views: 35

Answers (1)

Jordan Tan Jun Wen
Jordan Tan Jun Wen

Reputation: 45

Can use

for (Method method : classfile.getMethods()) {

which is under the same BCEL library

Upvotes: 0

Related Questions