0

I want to add some code into all my project files with JavaAssist. And i will use the params of each method. But I found when using lambda,it generated a new method in class and the params of original method will be changed finally. So Does JavaAssist has something like visitInvokeDynamicInsn method in MethodVisitor in ASM,that I can get the original owner, params and name of method? thx.

Hand Some
  • 1
  • 1
  • 1
    It supports iterating over the code and it understands the invokedynamic instruction, but it doesn’t work like ASM. If we want to visit like with ASM, why don’t you use ASM? – Holger Apr 24 '20 at 08:22
  • I am learning JavaAssist and I want to implement functions in my project as ASM does. How does javaassist understands the invokedynamic instruction? Is there a method or API? Thank you very much. – Hand Some Apr 24 '20 at 08:37
  • 1
    Did you look at how you can use Javassist to study the bytecode instructions in general? The handling of invokedynamic is not different. – Holger Apr 24 '20 at 08:45
  • ASM has a “visitInvokeDynamicInsn” method in MethodVisitor , when the project runs invokedynamic instructionv, I can find many information like original params and name of the method in it, because lambda will generates a new method. So I just want to find that is there a method or sth in Javaassist. – Hand Some Apr 24 '20 at 08:57
  • 1
    You said, “I am learning JavaAssist”. You don’t lean it by looking what ASM does. There are tutorials out there. – Holger Apr 24 '20 at 09:05
  • The question suddenly occured to me when learning.Thanks anyway. – Hand Some Apr 24 '20 at 09:20
  • 1
    For completeness: [5.3 Traversing a method body on the tutorial](http://www.javassist.org/tutorial/tutorial3.html#traverse) and [the `CodeIterator` class](http://www.javassist.org/html/javassist/bytecode/CodeIterator.html), and [the `Opcode.INVOKEDYNAMIC`constant](http://www.javassist.org/html/javassist/bytecode/Opcode.html#INVOKEDYNAMIC). – Holger Apr 24 '20 at 09:43

0 Answers0