ForgeGradle icon indicating copy to clipboard operation
ForgeGradle copied to clipboard

Method Reference name clash leads to reobf problems

Open shartte opened this issue 5 years ago • 1 comments

We've just seen the following problem occur during remapping to srg names:

import net.minecraft.client.gui.widget.TextFieldWidget;
public class NumberBox extends TextFieldWidget {
  public NumberBox() {
    /* super()... */
    setResponder(this::onTextChanged); <---- (1)
  }

  private void onTextChanged(String text) {
    /* do some fancy validation and transformation stuff */
  }
}

The TextFieldWidget class also has a declaration with the MCP name onTextChanged, which is private. During reobf, the method handle in the NumberBox constructor is remapped to the SRG name of TextFieldWidget#onTextChanged, which then causes the folllowing runtime error in a non-dev environment:

 java.lang.IllegalAccessError: tried to access method net.minecraft.client.gui.widget.TextFieldWidget.func_212951_d(Ljava/lang/String;)V from class appeng.client.gui.widgets.NumberBox
minecraft_release=1.15
minecraft_version=1.15.2
mcp_mappings=20200715-1.15.1
forge_version=31.2.31

shartte avatar Jul 21 '20 19:07 shartte

Is this still an issue? Potentially fixed by newer SpecialSource version, and if not, moving everything to ForgeAutoRenamingTool instead of SpecialSource.

SizableShrimp avatar Jun 14 '22 02:06 SizableShrimp

Closing as no new information has been provided, and is likely fixed by FG6 with the move to FART for reobf.

SizableShrimp avatar Jun 01 '23 21:06 SizableShrimp