Skip to content
Merged
Show file tree
Hide file tree
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 @@ -21,6 +21,7 @@
package com.demonwav.mcdev.platform.mixin.handlers.mixinextras

import com.demonwav.mcdev.platform.mixin.handlers.InjectorAnnotationHandler
import com.demonwav.mcdev.platform.mixin.handlers.injectionPoint.NewInsnInjectionPoint
import com.demonwav.mcdev.platform.mixin.inspection.injector.MethodSignature
import com.demonwav.mcdev.platform.mixin.inspection.injector.ParameterGroup
import com.demonwav.mcdev.platform.mixin.util.FieldTargetMember
Expand Down Expand Up @@ -219,7 +220,7 @@ abstract class MixinExtrasInjectorAnnotationHandler : InjectorAnnotationHandler(
.resolveAsm(annotation.project) as? MethodTargetMember
)?.classAndMethod
val parameters = mutableListOf<Parameter>()
if (insn.opcode != Opcodes.INVOKESTATIC) {
if (insn.opcode != Opcodes.INVOKESTATIC && insn.name != "<init>") {
val receiver = if (insn.opcode == Opcodes.INVOKESPECIAL && !oldSuperBehavior) {
targetClass.name
} else {
Expand Down Expand Up @@ -270,6 +271,10 @@ abstract class MixinExtrasInjectorAnnotationHandler : InjectorAnnotationHandler(
Opcodes.INSTANCEOF ->
listOf(Parameter("object", Type.getType(Any::class.java).toPsiType(elementFactory)))

Opcodes.NEW -> NewInsnInjectionPoint.findInitCall(insn)?.let {
getPsiParameters(it, targetClass, annotation)
}

else -> null
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ import org.objectweb.asm.tree.MethodNode

class WrapOperationHandler : MixinExtrasInjectorAnnotationHandler() {
override val supportedInstructionTypes = listOf(
InstructionType.METHOD_CALL, InstructionType.FIELD_GET, InstructionType.FIELD_SET, InstructionType.INSTANCEOF
InstructionType.METHOD_CALL, InstructionType.FIELD_GET, InstructionType.FIELD_SET, InstructionType.INSTANCEOF,
InstructionType.INSTANTIATION
)

override fun getAtKey(annotation: PsiAnnotation): String {
Expand Down