quarkusio/gizmo

BytecodeCreator.invokeSpecialMethod() cannot be used for interface default methods

Closed this issue · 6 comments

It should be possible to use the invokeSpecial instruction to invoke an interface default method. However, BytecodeCreator.invokeSpecialMethod() always adds an InvokeOperation with interfaceMethod=false (constant pool contains Methodref instead of InterfaceMethodref).

We could either add a special method, something like BytecodeCreator.invokeSpecialInterfaceMethod() or add a variant with interfaceMethod boolean parameter.

I think an extra parameter makes sense.

I'll send a PR shortly.

Hm, that's interesting. It's not a problem for JVM and the generated bytecode works fine even if it looks broken. In other words JVM does not care whether the constant pool contains Methodref or InterfaceMethodref.

I have a fix here: https://github.com/mkouba/gizmo/tree/invoke-special

But I'm not really sure if it makes sense to send a PR.

I think this was actually fixed by #93.

I think this was actually fixed by #93.

I think so.