diff --git a/src/main/kotlin/platform/mixin/handlers/mixinextras/MixinExtrasInjectorAnnotationHandler.kt b/src/main/kotlin/platform/mixin/handlers/mixinextras/MixinExtrasInjectorAnnotationHandler.kt index f51107c77..b1f6b18b1 100644 --- a/src/main/kotlin/platform/mixin/handlers/mixinextras/MixinExtrasInjectorAnnotationHandler.kt +++ b/src/main/kotlin/platform/mixin/handlers/mixinextras/MixinExtrasInjectorAnnotationHandler.kt @@ -36,6 +36,7 @@ import com.demonwav.mcdev.util.toJavaIdentifier import com.intellij.psi.JavaPsiFacade import com.intellij.psi.PsiAnnotation import com.intellij.psi.PsiType +import com.intellij.psi.PsiTypes import org.objectweb.asm.Opcodes import org.objectweb.asm.Type import org.objectweb.asm.tree.AbstractInsnNode @@ -153,12 +154,18 @@ abstract class MixinExtrasInjectorAnnotationHandler : InjectorAnnotationHandler( } is FieldInsnNode -> { - val sourceClassAndField = ( - MemberReference(insn.name, insn.desc, insn.owner.replace('/', '.')) - .resolveAsm(annotation.project) as? FieldTargetMember - )?.classAndField - sourceClassAndField?.field?.getGenericType(sourceClassAndField.clazz, annotation.project) - ?: Type.getType(insn.desc).toPsiType(elementFactory) + when (insn.opcode) { + Opcodes.PUTFIELD, Opcodes.PUTSTATIC -> PsiTypes.voidType() + else -> { + val sourceClassAndField = ( + MemberReference(insn.name, insn.desc, insn.owner.replace('/', '.')) + .resolveAsm(annotation.project) as? FieldTargetMember + )?.classAndField + + sourceClassAndField?.field?.getGenericType(sourceClassAndField.clazz, annotation.project) + ?: Type.getType(insn.desc).toPsiType(elementFactory) + } + } } else -> getInsnReturnType(insn)?.toPsiType(elementFactory)