I am trying to implement duck typing with invokedynamic
in JVM7. I created two different classes, both of them have a greet()
method that returns a String
. I randomly select one of them, save the instance on the stack, and invokedynamic
(using ASM).
I wonder if I can access the arguments in the bootstrap method. Because I cannot return the corresponding CallSite
with target
without knowing which object is on the stack and which of the greet()
methods should be returned.
If my approach is wrong, what is the right approach?
source share