java - How to determine the Method invoked by an InvokeInstruction (BCEL)? -


i trying determine methodgen of callee given invokeinstruction in bcel library. problem don't know how use invokeinstruction methodgen trying invoke.

if have bcel methodgen object main method of program, can go through list of instructions , find ones invokeinstructions:

// assume methodgen mainmg given instruction[] insns = mainmg.getinstructionlist().getinstructions(); for(instruction insn : insns) {     if(insn instanceof invokeinstruction) {         // great, found invoke instruction         invokeinstruction invoke = (invokeinstruction)insn;          // do now?     } } 

some of bcel's documentation great , other parts kind of lacking. suggestions how link invokeinstruction methodgen of method being invoked?

if simplifies things, can assume program doesn't have polymorphism. though @ point have deal (conservatively).


clarification: realize there isn't direct route doing (e.g. invoke.getcalledmethodgen()), wondering if there way can enough distinct information invoke instruction (e.g. method's fqn or equiv.) can link method being called.

generally can't. bcel , of other frameworks working bytecode operating on single class. so, have read available classes (could lazily) , build own repository of methodgens (e.g. map of fqn method name methodgen instances).


Comments

Popular posts from this blog

django - How can I change user group without delete record -

java - Need to add SOAP security token -

java - EclipseLink JPA Object is not a known entity type -