User: joe Date: 25 Sep 23 01:01 Revision: ef3663e906d1ff921413c4e41e96ee6a42ce0a4f Summary: Merge branch '2022.3' into 2023.1 # Conflicts: # src/main/kotlin/util/code-gen.kt TeamCity URL: https://ci.mcdev.io/viewModification.html?tab=vcsModificationFiles&modId=8791&personal=false Index: src/main/kotlin/platform/mixin/config/inspection/ConfigValueInspection.kt =================================================================== --- src/main/kotlin/platform/mixin/config/inspection/ConfigValueInspection.kt (revision 07e5f88d5e1d1c24210d9972fde9258788b1e704) +++ src/main/kotlin/platform/mixin/config/inspection/ConfigValueInspection.kt (revision ef3663e906d1ff921413c4e41e96ee6a42ce0a4f) @@ -40,6 +40,7 @@ import com.intellij.psi.CommonClassNames.JAVA_LANG_LONG import com.intellij.psi.CommonClassNames.JAVA_LANG_SHORT import com.intellij.psi.CommonClassNames.JAVA_LANG_STRING +import com.intellij.psi.CommonClassNames.JAVA_LANG_STRING_SHORT import com.intellij.psi.PsiArrayType import com.intellij.psi.PsiClassType import com.intellij.psi.PsiElementVisitor @@ -96,15 +97,18 @@ return true // Idk, it's fine I guess } - if (type.equalsToText(JAVA_LANG_STRING)) { + if (type.className == JAVA_LANG_STRING_SHORT && type.resolve()?.qualifiedName == JAVA_LANG_STRING) { return value is JsonStringLiteral } - if (type.equalsToText(CommonClassNames.JAVA_LANG_BOOLEAN)) { + if (type.className == "Boolean" && type.resolve()?.qualifiedName == CommonClassNames.JAVA_LANG_BOOLEAN) { return value is JsonBooleanLiteral || value is JsonNullLiteral } - if (qualifiedNumberNames.any(type::equalsToText)) { + if ( + shortNumberNames.contains(type.className) && + qualifiedNumberNames.contains(type.resolve()?.qualifiedName) + ) { return value is JsonNumberLiteral || value is JsonNullLiteral } @@ -112,7 +116,8 @@ return value is JsonObject } - private val qualifiedNumberNames = listOf( + private val shortNumberNames = setOf("Byte", "Character", "Double", "Float", "Integer", "Long", "Short") + private val qualifiedNumberNames = setOf( JAVA_LANG_BYTE, JAVA_LANG_CHARACTER, JAVA_LANG_DOUBLE, Index: src/main/kotlin/util/code-gen.kt =================================================================== --- src/main/kotlin/util/code-gen.kt (revision 07e5f88d5e1d1c24210d9972fde9258788b1e704) +++ src/main/kotlin/util/code-gen.kt (revision ef3663e906d1ff921413c4e41e96ee6a42ce0a4f) @@ -26,19 +26,21 @@ import com.intellij.psi.JavaPsiFacade import com.intellij.psi.PsiAnnotation import com.intellij.psi.PsiClass +import com.intellij.psi.PsiClassType import com.intellij.psi.PsiMember import com.intellij.psi.PsiMethod import com.intellij.psi.PsiTypes +import com.intellij.psi.search.GlobalSearchScope -fun createVoidMethodWithParameterType(project: Project, name: String, paramType: PsiClass): PsiMethod { - val elementFactory = JavaPsiFacade.getElementFactory(project) - val newMethod = elementFactory.createMethod(name, PsiTypes.voidType()) +fun createVoidMethodWithParameterType(project: Project, name: String, paramType: PsiClass): PsiMethod? { + val newMethod = JavaPsiFacade.getElementFactory(project).createMethod(name, PsiTypes.voidType()) val list = newMethod.parameterList - val parameter = elementFactory + val qName = paramType.qualifiedName ?: return null + val parameter = JavaPsiFacade.getElementFactory(project) .createParameter( "event", - elementFactory.createType(paramType) + PsiClassType.getTypeByName(qName, project, GlobalSearchScope.allScope(project)), ) list.add(parameter)