User: joe Date: 24 Sep 23 16:33 Revision: 07e5f88d5e1d1c24210d9972fde9258788b1e704 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=8782&personal=false Index: src/main/kotlin/platform/mixin/config/inspection/ConfigValueInspection.kt =================================================================== --- src/main/kotlin/platform/mixin/config/inspection/ConfigValueInspection.kt (revision 6a04b37ddbfe159e72fbf5e0cce97bf9cd068aa0) +++ src/main/kotlin/platform/mixin/config/inspection/ConfigValueInspection.kt (revision 07e5f88d5e1d1c24210d9972fde9258788b1e704) @@ -40,7 +40,6 @@ 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 @@ -97,18 +96,15 @@ return true // Idk, it's fine I guess } - if (type.className == JAVA_LANG_STRING_SHORT && type.resolve()?.qualifiedName == JAVA_LANG_STRING) { + if (type.equalsToText(JAVA_LANG_STRING)) { return value is JsonStringLiteral } - if (type.className == "Boolean" && type.resolve()?.qualifiedName == CommonClassNames.JAVA_LANG_BOOLEAN) { + if (type.equalsToText(CommonClassNames.JAVA_LANG_BOOLEAN)) { return value is JsonBooleanLiteral || value is JsonNullLiteral } - if ( - shortNumberNames.contains(type.className) && - qualifiedNumberNames.contains(type.resolve()?.qualifiedName) - ) { + if (qualifiedNumberNames.any(type::equalsToText)) { return value is JsonNumberLiteral || value is JsonNullLiteral } @@ -116,8 +112,7 @@ return value is JsonObject } - private val shortNumberNames = setOf("Byte", "Character", "Double", "Float", "Integer", "Long", "Short") - private val qualifiedNumberNames = setOf( + private val qualifiedNumberNames = listOf( 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 6a04b37ddbfe159e72fbf5e0cce97bf9cd068aa0) +++ src/main/kotlin/util/code-gen.kt (revision 07e5f88d5e1d1c24210d9972fde9258788b1e704) @@ -26,21 +26,19 @@ 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 newMethod = JavaPsiFacade.getElementFactory(project).createMethod(name, PsiTypes.voidType()) +fun createVoidMethodWithParameterType(project: Project, name: String, paramType: PsiClass): PsiMethod { + val elementFactory = JavaPsiFacade.getElementFactory(project) + val newMethod = elementFactory.createMethod(name, PsiTypes.voidType()) val list = newMethod.parameterList - val qName = paramType.qualifiedName ?: return null - val parameter = JavaPsiFacade.getElementFactory(project) + val parameter = elementFactory .createParameter( "event", - PsiClassType.getTypeByName(qName, project, GlobalSearchScope.allScope(project)), + elementFactory.createType(paramType) ) list.add(parameter) Index: src/main/resources/META-INF/plugin.xml =================================================================== --- src/main/resources/META-INF/plugin.xml (revision 6a04b37ddbfe159e72fbf5e0cce97bf9cd068aa0) +++ src/main/resources/META-INF/plugin.xml (revision 07e5f88d5e1d1c24210d9972fde9258788b1e704) @@ -649,13 +649,6 @@ -