Skip to content

Commit

Permalink
2024.1 creator fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
RedNesto committed Jul 14, 2024
1 parent c03b990 commit 1fed5ef
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ class CreatorFinalizerBean : BaseKeyedLazyInstance<CreatorFinalizer>(), KeyedLaz
@RequiredElement
lateinit var implementation: String

override fun getKey(): String? = type
override fun getKey(): String = type

override fun getImplementationClassName(): String? = implementation
}
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ class TemplateProviderBean : BaseKeyedLazyInstance<TemplateProvider>(), KeyedLaz
@RequiredElement
lateinit var implementation: String

override fun getKey(): String? = name
override fun getKey(): String = name

override fun getImplementationClassName(): String? = implementation
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

/**
Expand All @@ -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
Expand Down

0 comments on commit 1fed5ef

Please sign in to comment.