Invoking Method using BCEL
is there any expert in this community who have worked with BCEL and can guide me about invo开发者_如何转开发cation of method using BCEL just like we use to do with java reflection.
Note:to support your answer any sort of book or web reference will become a great source of help.
Now i have seen a interface named Visitor containing method visitInvokeInstruction() Now is there a way so that i can invoke these instruction(that formed a method on stack).
Hope this piece of code give u people a lot of explanation what i want.
thanks in advance
The best way is to use BCELifier, a class that comes with BCEL that takes a classfile and emits source code that uses BCEL to emit that classfile - essentially it decompiles the classfile not into bytecodes or the original Java source, but the BCEL code required to emit that.
In your case, just write a simple, dummy class that contains the code you want to produce, then run BCELifier and check the results.
精彩评论