Mixin
Mixin copied to clipboard
Allow @Invoker usage for interfaces
Use case
Expose some class internals as non obfuscated fields, for usage with nashorn;
I.e if i want to be able to call ITextComponent#append, without bothering about script remapping:
@Mixin(ITextComponent.class)
public interface MixinITextComponent {
@Invoker
ITextComponent appendText(String text);
}
Before this commit, generated bytecode was
public synthetic appendText(java.lang.String arg0) { //(Ljava/lang/String;)Lhh;
aload0 // reference to self
aload1
invokevirtual hh.a(Ljava/lang/String;)Lhh;
areturn
}
But correct should be
public synthetic appendText(java.lang.String arg0) { //(Ljava/lang/String;)Lhh;
aload0 // reference to self
aload1
invokeinterface hh.a(Ljava/lang/String;)Lhh;
areturn
}
This looks sensible, I will take a look at this and validate there are no unexpected side-effects.