Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow @Invoker usage for interfaces #413

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

CertainLach
Copy link

@CertainLach CertainLach commented Jun 17, 2020

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
     }

@Mumfrey
Copy link
Member

Mumfrey commented Jun 18, 2020

This looks sensible, I will take a look at this and validate there are no unexpected side-effects.

Chocohead added a commit to Chocohead/Mixin that referenced this pull request Jun 16, 2021
modmuss50 pushed a commit to FabricMC/Mixin that referenced this pull request Jun 28, 2021
* Allow mixining interfaces

Reapplies #13
Fixes #34
Includes (a form of) SpongePowered#413 and SpongePowered#415

* Fix mods using static vagueness

Whilst SpongePowered#415 is generating things more correctly, there are mods (such as Better End) which rely on the current behaviour

* Fix lambdas in interface Mixins

Fixes #43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants