Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down