Skip to content

Failure to remap Mixin method reference if the class it is in is obfuscated, but it is an override of a non-obfuscated method. #155

@MildestToucan

Description

@MildestToucan

This issue was made apparent with the specific scenario of trying to target NonNullList#add(Object) in AbstractContainerMenu (MojMaps) with an injector.

Steps to reproduce

Specifically, this happened with Loom 1.14.7, on a mod project targeting Minecraft 1.21.10;
Whilst the Mixin worked just fine in a dev environment, it consistently crashed in production whenever targeting NonNullList#add. When dumping targets on failure was enabled:
The merged injector appeared as:

Image

and the target method as:

Image

Notice that the reference to the NonNullList field, named slots in MojMaps, was properly remapped, but how the NonNullField#add reference failed to be remapped.

The Fixes that worked

When using an expression to substitute add with a wildcard, the Mixin applied successfully. Upon LlamaLad prompting me to attempt reproducing the issue with the legacy AP enabled, the Mixin worked fine without needing to avoid targeting add directly.

A Gist of the post-fix buildscript and Mixin: https://gist.github.com/MildestToucan/06ae540b3c7c70e01ec2f4523ae76f27

This would indicate that without the AP, TR fails to remap when a Mixin tries to target a call to a method inherited from a non-obfuscated class, if in the context of it being called on an obfuscated class.

The Discord link for the discussion relating to this issue: https://discord.com/channels/507304429255393322/807617700734042122/1451510948740206592 and below.

A similar issue was brought up by dicedpixels after LlamaLad had prompted me to open this issue, linking me to https://discord.com/channels/507304429255393322/507982478276034570/1433480059267715184

where similar issues were experienced with trying to reference add in the context of MerchantOffers, an obfuscated class extending ArrayList.

I have insufficient knowledge to know how to solve this issue, but I was prompted by LlamaLad to open an issue here regarding it. I'm willing to provide additional details if needed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions