Skip to content

Commit

Permalink
Replace deprecated constants with PsiTypes methods
Browse files Browse the repository at this point in the history
  • Loading branch information
RedNesto committed Oct 14, 2023
1 parent ef3663e commit b29af86
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ package com.demonwav.mcdev.platform.mixin.handlers.mixinextras
import com.demonwav.mcdev.platform.mixin.inspection.injector.ParameterGroup
import com.intellij.psi.PsiAnnotation
import com.intellij.psi.PsiType
import com.intellij.psi.PsiTypes
import org.objectweb.asm.Type
import org.objectweb.asm.tree.AbstractInsnNode
import org.objectweb.asm.tree.ClassNode
Expand All @@ -44,6 +45,6 @@ class WrapWithConditionHandler : MixinExtrasInjectorAnnotationHandler() {
insn: AbstractInsnNode
): Pair<ParameterGroup, PsiType>? {
val params = getPsiParameters(insn, targetClass, annotation) ?: return null
return ParameterGroup(params) to PsiType.BOOLEAN
return ParameterGroup(params) to PsiTypes.booleanType()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ import com.intellij.psi.PsiMethodCallExpression
import com.intellij.psi.PsiParameter
import com.intellij.psi.PsiParameterList
import com.intellij.psi.PsiReturnStatement
import com.intellij.psi.PsiType
import com.intellij.psi.PsiTypes
import com.intellij.psi.codeStyle.VariableKind
import com.intellij.psi.impl.light.LightParameter
import com.intellij.psi.search.LocalSearchScope
Expand Down Expand Up @@ -149,7 +149,7 @@ class InjectCouldBeOverwriteInspection : MixinInspection() {
memState.applyCondition(ciVar.eq(stableCiVar))
val isCancelledVar = PlainDescriptor.createVariableValue(
factory,
LightParameter("isCancelled", PsiType.BOOLEAN, methodBody)
LightParameter("isCancelled", PsiTypes.booleanType(), methodBody)
)
memState.setVarValue(isCancelledVar, falseValue)

Expand Down
3 changes: 2 additions & 1 deletion src/main/kotlin/platform/mixin/util/Mixin.kt
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ import com.intellij.psi.PsiMethod
import com.intellij.psi.PsiParameter
import com.intellij.psi.PsiPrimitiveType
import com.intellij.psi.PsiType
import com.intellij.psi.PsiTypes
import com.intellij.psi.search.GlobalSearchScope
import com.intellij.psi.util.InheritanceUtil
import com.intellij.psi.util.PsiModificationTracker
Expand Down Expand Up @@ -165,7 +166,7 @@ fun isAssignable(left: PsiType, right: PsiType, allowPrimitiveConversion: Boolea
left is PsiArrayType -> right is PsiArrayType && isAssignable(left.componentType, right.componentType)
else -> {
if (left !is PsiClassType || right !is PsiClassType) {
if (right == PsiType.NULL && left !is PsiPrimitiveType) {
if (right == PsiTypes.nullType() && left !is PsiPrimitiveType) {
return true
}
if (!allowPrimitiveConversion && (left is PsiPrimitiveType || right is PsiPrimitiveType)) {
Expand Down

0 comments on commit b29af86

Please sign in to comment.