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

Usages of shadowed fields in anonymous classes are not remapped to project mappings. #84

Open
MattiDragon opened this issue Mar 11, 2022 · 0 comments

Comments

@MattiDragon
Copy link

Description

When you use a shadowed field in an anonymous class inside a mixin, it doesn't get remapped properly. This only happens when remapping from intermediary to named and thus only affects external mixins in a dev environment, such as those from mods in run/mods or dependencies.

Reproducing

  • Extract the this zip archive and open the project
  • Run minecraft in the dev environment.
    • Note the tests printed in the logs at startup. They all should be passing
  • Build this mod using the build task
  • Set up a new or open an old development environment.
  • Put the built jar from build/libs/ into run/mods/ on the other project.
  • Run minecraft in the other project.
    • Note that the test fails on Anonymous with a NoSuchFieldError.
  • (optional) Run the mod in a production environment.
    • Note that all tests pass.

Analysis

It works in the original dev environment because nothing is remapped, and it works in the production environment because it is properly remapped to intermediary.

Mixin remaps shadowed fields at runtime, but it misses the usages in the anonymous class, probably because it is in a different class file and mixin expects all usages to be in the mixin itself.

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

No branches or pull requests

1 participant