ProguardCORE: Usage of invokedynamic in InstructionSequenceBuilder

How can such an invokedynamic instruction be achieved with the InstructionSequenceBuilder in proguardcore?

As far as I know, there’s no way to provide the bootstrap method arguments with .invokedynamic(…) in the InstructionSequenceBuilder.
Any help is greatly appreciated. Thanks

Hi @willymuks !

You can add the method arguments to the BootStrapMethodInfo which you can add with a BootstrapMethodsAttributeAdder.

See for example here. Note that I didn’t actually use the method arguments, so it may not be enough but it should get you started.

2 Likes

Hi James.

Thanks for the response. So, I ended up applying what you suggested as seen below. I just want to confirm that I’m on the right track.

It depends on what your goal is. Are those arguments for the bootstrap method arguments or for the invocation?

If they’re for the bootstrap method arguments, then something like that seems correct.
If they’re for the invocation, they should be on the stack before the invokedynamic instruction.