MinecraftDev
MinecraftDev copied to clipboard
When injecting at certain points and capturing locals, mixin method arguments are highlighted as incorrect
trafficstars
- Minecraft Development for IntelliJ plugin version = 2021.3-1.5.18
- IntelliJ version = 2021.3.1 (213.6461.79)
- Operating System (this has come up enough times to be worth noting) = win10
- (optional) Target platform, if relevant = Mixin 0.8.4, Forge 1.16.5-36.2.23
-
I made a mixin into a method of another mod, so
remap = false.- Target method is
public static, with a generic return parameterT. - Injection was an
@Injectat"RETURN", with capture of a single local variable. - Captured local variable is the only one declared in method body.
- Therefore, method parameters of my injection looked like
({targetMethodArgs}, CallbackInfoReturnable<T>, LocalVariableType). - Everything works nicely, no complaints from the plugin, works ingame.
- Target method is
-
After that, I change the injection from
"RETURN"to"JUMP", opcode = Opcodes.IFEQ, ordinal = 1, there are a total of 2 of those opcodes in the target method.- Plugin highlights method parameters of injection as incorrect, error message "Method parameters do not match expected parameters for Inject".
- Accepting the option "Fix method parameters" does nothing.
- Mixin still applies and works correctly.
- Removing the local variable removed the error.
I do understand that both injecting at "JUMP" and capturing locals in the same injection might be undesirable. However, it should probably only raise a warning, or at least remove the offender when using "Fix method parameters".
Also applies when injecting at "INVOKE_ASSIGN"
Relates to #1884