`#mixin Share` is written onto the handler method instead of its parameter
ZenUtils 1.27.5, same code on master (067e5ba), MixinExtras 0.5.3.
#mixin Share never reaches MixinExtras, so a shared local can't be used from a script. Tested on a dedicated server with two injectors on the same method:
#loader mixin
#mixin {targets: "atomicstryker.infernalmobs.common.InfernalMobsCore"}
zenClass ZzProbeShareMixin {
#mixin Inject {method: "loadConfig", at: {value: "HEAD"}, require: 0}
#mixin Share{value: "zzProbeShared"}
function zenutils_probeShareSet(ci as mixin.CallbackInfo, shared as int[]) as void {
shared[0] = 42;
print("[probe] E: HEAD set shared to 42");
}
#mixin Inject {method: "loadConfig", at: {value: "TAIL"}, require: 0}
#mixin Share{value: "zzProbeShared"}
function zenutils_probeShareGet(ci as mixin.CallbackInfo, shared as int[]) as void {
if(shared[0] == 42) print("[probe] E: TAIL read shared 42");
else print("[probe] E: TAIL read shared NOT 42");
}
}
Error occurred when applying mixin ZzProbeShareMixin to class atomicstryker.infernalmobs.common.InfernalMobsCore
InvalidInjectionException: Invalid descriptor on mixins.zenutils.custom.json:ZzProbeShareMixin from owner unknown-owner->@Inject::zenutils_probeShareSet$ref$bridge(Lorg/spongepowered/asm/mixin/injection/callback/CallbackInfo;Lcom/llamalad7/mixinextras/sugar/ref/LocalIntRef;)V! Expected (Lorg/spongepowered/asm/mixin/injection/callback/CallbackInfo;)V but found (Lorg/spongepowered/asm/mixin/injection/callback/CallbackInfo;Lcom/llamalad7/mixinextras/sugar/ref/LocalIntRef;)V
With #mixin Share{value: "zzProbeShared", parameter: 1} it fails to parse instead: parameter does not exist in interface com.llamalad7.mixinextras.sugar.Share.
applyAnnotation counts Share as a ref parameter and builds the LocalIntRef bridge, but generatePlainMixinMethod only puts Cancellable and Local on a parameter (and strips their parameter/ref). Share falls through to the method annotation branch:
https://github.com/friendlyhj/ZenUtils/blob/067e5ba034a38cc3c4fe4fcf25559d52f94a482f/src/main/java/youyihj/zenutils/impl/mixin/zenscript/MixinParsedZenClassMethod.java#L138-L156
Adding "Share" to that condition fixes it: with only || "Share".equals(annotationName) patched into the 1.27.5 jar, the same script applies without errors and the TAIL injector reads 42.