Hello, 
 
I'm a new user of BCEL. I am trying to get access to methods called from within 
methods. I tried all possible classes that I could think of, but in vain. Can 
somebody help me out please ?
 
My Class 'myClass' has two methods A, B ; and the main method calls method A 
which in turn calls method B, I was able to get the main method and print its 
code using the following code:
 
JavaClass clazz = Repository.lookupClass(myClass);
Method[] methods = clazz.getMethods();
for(int i=0; i < methods.length; i++){
    if("main".equals(methods[i].getName())){
        Code code = methods[i].getCode();
        System.out.println(code.toString());
    }
}
 
How can I get access to method A from within main ?
I want to print out the fact that main calls method A.
Then get access to method A's code from there and print out the fact that it 
calls method B.
 
Any help is greatly appreciated.
 
Thanks,
Steve
 

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

Reply via email to