From 1fed5efbc031cb12a38ec6665897eb9974c7984b Mon Sep 17 00:00:00 2001 From: RedNesto Date: Sun, 14 Jul 2024 13:19:31 +0200 Subject: [PATCH] 2024.1 creator fixes --- src/main/kotlin/creator/custom/finalizers/CreatorFinalizer.kt | 2 +- .../creator/custom/finalizers/ImportMavenProjectFinalizer.kt | 4 ++-- src/main/kotlin/creator/custom/providers/TemplateProvider.kt | 2 +- .../expression/psi/mixins/impl/MEAssignStatementImplMixin.kt | 1 - .../expression/psi/mixins/impl/MEBinaryExpressionImplMixin.kt | 3 +-- .../expression/psi/mixins/impl/MECastExpressionImplMixin.kt | 3 +-- .../inspection/suppress/MixinClassCastInspectionSuppressor.kt | 3 +-- 7 files changed, 7 insertions(+), 11 deletions(-) diff --git a/src/main/kotlin/creator/custom/finalizers/CreatorFinalizer.kt b/src/main/kotlin/creator/custom/finalizers/CreatorFinalizer.kt index 4442f33f7..1c52d25f6 100644 --- a/src/main/kotlin/creator/custom/finalizers/CreatorFinalizer.kt +++ b/src/main/kotlin/creator/custom/finalizers/CreatorFinalizer.kt @@ -122,7 +122,7 @@ class CreatorFinalizerBean : BaseKeyedLazyInstance(), KeyedLaz @RequiredElement lateinit var implementation: String - override fun getKey(): String? = type + override fun getKey(): String = type override fun getImplementationClassName(): String? = implementation } diff --git a/src/main/kotlin/creator/custom/finalizers/ImportMavenProjectFinalizer.kt b/src/main/kotlin/creator/custom/finalizers/ImportMavenProjectFinalizer.kt index 38aefd975..88ce4cae9 100644 --- a/src/main/kotlin/creator/custom/finalizers/ImportMavenProjectFinalizer.kt +++ b/src/main/kotlin/creator/custom/finalizers/ImportMavenProjectFinalizer.kt @@ -26,7 +26,7 @@ import com.intellij.openapi.project.Project import com.intellij.openapi.vfs.VfsUtil import java.nio.file.Path import kotlinx.coroutines.runBlocking -import org.jetbrains.idea.maven.buildtool.MavenImportSpec +import org.jetbrains.idea.maven.buildtool.MavenSyncSpec import org.jetbrains.idea.maven.project.MavenProjectsManager class ImportMavenProjectFinalizer : CreatorFinalizer { @@ -45,7 +45,7 @@ class ImportMavenProjectFinalizer : CreatorFinalizer { val projectsManager = MavenProjectsManager.getInstance(project) projectsManager.addManagedFiles(listOf(pomFile)) runBlocking { - projectsManager.updateAllMavenProjects(MavenImportSpec(true, true, false)) + projectsManager.updateAllMavenProjects(MavenSyncSpec.incremental("ImportMavenProjectFinalizer", false)) } thisLogger().info("Import finished") diff --git a/src/main/kotlin/creator/custom/providers/TemplateProvider.kt b/src/main/kotlin/creator/custom/providers/TemplateProvider.kt index 30efddbb2..608864e85 100644 --- a/src/main/kotlin/creator/custom/providers/TemplateProvider.kt +++ b/src/main/kotlin/creator/custom/providers/TemplateProvider.kt @@ -220,7 +220,7 @@ class TemplateProviderBean : BaseKeyedLazyInstance(), KeyedLaz @RequiredElement lateinit var implementation: String - override fun getKey(): String? = name + override fun getKey(): String = name override fun getImplementationClassName(): String? = implementation } diff --git a/src/main/kotlin/platform/mixin/expression/psi/mixins/impl/MEAssignStatementImplMixin.kt b/src/main/kotlin/platform/mixin/expression/psi/mixins/impl/MEAssignStatementImplMixin.kt index f3fbfb396..534edcb82 100644 --- a/src/main/kotlin/platform/mixin/expression/psi/mixins/impl/MEAssignStatementImplMixin.kt +++ b/src/main/kotlin/platform/mixin/expression/psi/mixins/impl/MEAssignStatementImplMixin.kt @@ -38,7 +38,6 @@ abstract class MEAssignStatementImplMixin(node: ASTNode) : MEStatementImpl(node) val isOperatorAssignment = java.operationTokenType != JavaTokenType.EQ val expandedJava = if (isOperatorAssignment) { PsiReplacementUtil.replaceOperatorAssignmentWithAssignmentExpression(java.copy() as PsiAssignmentExpression) - as PsiAssignmentExpression } else { java } diff --git a/src/main/kotlin/platform/mixin/expression/psi/mixins/impl/MEBinaryExpressionImplMixin.kt b/src/main/kotlin/platform/mixin/expression/psi/mixins/impl/MEBinaryExpressionImplMixin.kt index 96c6ae245..fef3edfe8 100644 --- a/src/main/kotlin/platform/mixin/expression/psi/mixins/impl/MEBinaryExpressionImplMixin.kt +++ b/src/main/kotlin/platform/mixin/expression/psi/mixins/impl/MEBinaryExpressionImplMixin.kt @@ -33,7 +33,6 @@ import com.intellij.psi.PsiElement import com.intellij.psi.PsiInstanceOfExpression import com.intellij.psi.PsiTypeTestPattern import com.intellij.psi.tree.TokenSet -import com.intellij.psi.util.JavaPsiPatternUtil import com.intellij.psi.util.PsiUtil abstract class MEBinaryExpressionImplMixin(node: ASTNode) : MEExpressionImpl(node), MEBinaryExpressionMixin { @@ -51,7 +50,7 @@ abstract class MEBinaryExpressionImplMixin(node: ASTNode) : MEExpressionImpl(nod return false } val javaType = java.checkType?.type - ?: (JavaPsiPatternUtil.skipParenthesizedPatternDown(java.pattern) as? PsiTypeTestPattern) + ?: (java.pattern as? PsiTypeTestPattern) ?.checkType?.type ?: return false return castType?.matchesJava(javaType, context) == true diff --git a/src/main/kotlin/platform/mixin/expression/psi/mixins/impl/MECastExpressionImplMixin.kt b/src/main/kotlin/platform/mixin/expression/psi/mixins/impl/MECastExpressionImplMixin.kt index 866999357..090e1b8c3 100644 --- a/src/main/kotlin/platform/mixin/expression/psi/mixins/impl/MECastExpressionImplMixin.kt +++ b/src/main/kotlin/platform/mixin/expression/psi/mixins/impl/MECastExpressionImplMixin.kt @@ -32,7 +32,6 @@ import com.intellij.psi.PsiElement import com.intellij.psi.PsiInstanceOfExpression import com.intellij.psi.PsiTypeCastExpression import com.intellij.psi.PsiTypeTestPattern -import com.intellij.psi.util.JavaPsiPatternUtil import com.intellij.psi.util.PsiUtil abstract class MECastExpressionImplMixin(node: ASTNode) : MEExpressionImpl(node), MECastExpressionMixin { @@ -50,7 +49,7 @@ abstract class MECastExpressionImplMixin(node: ASTNode) : MEExpressionImpl(node) castedExpr?.matchesJava(javaOperand, context) == true } is PsiInstanceOfExpression -> { - val pattern = JavaPsiPatternUtil.skipParenthesizedPatternDown(java.pattern) as? PsiTypeTestPattern + val pattern = java.pattern as? PsiTypeTestPattern ?: return false val javaType = pattern.checkType?.type ?: return false val castedExpr = this.castedExpr ?: return false diff --git a/src/main/kotlin/platform/mixin/inspection/suppress/MixinClassCastInspectionSuppressor.kt b/src/main/kotlin/platform/mixin/inspection/suppress/MixinClassCastInspectionSuppressor.kt index 79ea61bfb..e2d2a1757 100644 --- a/src/main/kotlin/platform/mixin/inspection/suppress/MixinClassCastInspectionSuppressor.kt +++ b/src/main/kotlin/platform/mixin/inspection/suppress/MixinClassCastInspectionSuppressor.kt @@ -38,7 +38,6 @@ import com.intellij.psi.PsiInstanceOfExpression import com.intellij.psi.PsiType import com.intellij.psi.PsiTypeCastExpression import com.intellij.psi.PsiTypeTestPattern -import com.intellij.psi.util.JavaPsiPatternUtil import com.intellij.psi.util.PsiUtil /** @@ -55,7 +54,7 @@ class MixinClassCastInspectionSuppressor : InspectionSuppressor { // check instanceof if (element is PsiInstanceOfExpression) { val castType = element.checkType?.type - ?: (JavaPsiPatternUtil.skipParenthesizedPatternDown(element.pattern) as? PsiTypeTestPattern) + ?: (element.pattern as? PsiTypeTestPattern) ?.checkType?.type ?: return false var operand = PsiUtil.skipParenthesizedExprDown(element.operand) ?: return false