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

Support for injection into static interface methods #318

Open
Siphalor opened this issue Apr 17, 2019 · 2 comments
Open

Support for injection into static interface methods #318

Siphalor opened this issue Apr 17, 2019 · 2 comments

Comments

@Siphalor
Copy link

So I'm in a situation where I mixin to an interface.
I'd like to @Inject into a public static method but I can't because the system wants my injection method to be private|protected static but this is not possible for interface methods.

Theoretically there shouldn't be a huge difference between static methods on classes and interfaces.

@Mumfrey
Copy link
Member

Mumfrey commented Apr 24, 2019

Sorry for slow reply, I've been away at an event.

Ah I see, yes. The restriction is basically there to stop people adding public static members to mixins because under normal circumstances there would be no way to invoke them. However this restriction could be removed in both of the following cirumstances:

  • The mixin is an interface mixin and the method is decorated with an injector annotation (your scenario)
  • The mixin is an Accessor Mixin, which are in fact loadable and can be referenced by userland code (and other mixin code)

Will relax this restriction and consider it enhancement.

@asiekierka
Copy link
Contributor

Personal take on the former, but probably deeper and scarier refactors are required for the latter: FabricMC#13

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

No branches or pull requests

3 participants