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

Not possible to reference private inner classes in method signatures #44

Open
NotMyWing opened this issue Jul 24, 2023 · 1 comment
Open
Labels
enhancement New feature or request invalid This doesn't seem right

Comments

@NotMyWing
Copy link

It's currently impossible to reference instances of private inner classes (specifically, of other mods, which can't traditionally be access transformed) in method signatures. Coercing arguments also doesn't seem to be possible, as Mixin strictly expects the signature to be A$B, so defining the argument as Object fails at runtime. @Local expects A$B as well. This leaves no options for targeting the instance.

Example class:

class A {
  method(B b);

  static class B {}
}

Example mixin:

interface IExtendedB {}

@Mixin(B.class)
class mB implements IExtendedB {}

@Mixin(A.class)
class mA {
  @Inject(method = "method", ...)
  public void injection(A.B b, CallbackInfo ci) {} // oops! fails at compile-time
  public void injection(CallbackInfo ci, @Local IExtendedB b) {} // oops! fails at runtime
  public void injection(CallbackInfo ci, @Local Object b) {} // oops! failed to validate at runtime
}
@NotMyWing
Copy link
Author

Update: I might be an idiot, but @Coerce finally worked in my environment RIGHT AFTER I have submitted this.

public void injection(@Coerce Object b, ...)

Feel free to close this or do as you see fit.

@Rongmario Rongmario added the enhancement New feature or request label Aug 16, 2023
@Rongmario Rongmario added the invalid This doesn't seem right label Mar 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request invalid This doesn't seem right
Projects
None yet
Development

No branches or pull requests

2 participants