From 9fe419c236a7fb1b8be768e73055142b27664782 Mon Sep 17 00:00:00 2001 From: RedNesto Date: Sun, 2 Jul 2023 23:24:49 +0200 Subject: [PATCH] Fixes for latest EAP breaking changes --- build.gradle.kts | 1 + gradle.properties | 4 ++-- .../mixin/insight/MixinTargetLineMarkerProvider.kt | 6 +++--- .../sponge/inspection/SpongePluginClassInspection.kt | 2 +- src/main/kotlin/util/class-utils.kt | 11 +---------- 5 files changed, 8 insertions(+), 16 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index d44ec05b7..81e81fa53 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -254,6 +254,7 @@ tasks.test { } } systemProperty("NO_FS_ROOTS_ACCESS_CHECK", "true") + systemProperty("java.awt.headless", "true") jvmArgs( "-Dsun.io.useCanonCaches=false", diff --git a/gradle.properties b/gradle.properties index 6025aa45e..02fc19279 100644 --- a/gradle.properties +++ b/gradle.properties @@ -21,13 +21,13 @@ # suppress inspection "UnusedProperty" for whole file kotlin.code.style=official -ideaVersion = 232-EAP-SNAPSHOT +ideaVersion = 232.8453.116-EAP-SNAPSHOT ideaVersionName = 2023.2 coreVersion = 1.6.6 downloadIdeaSources = true -pluginTomlVersion = 232.5150.113 +pluginTomlVersion = 232.8453.111 # Silences a build-time warning because we are bundling our own kotlin library kotlin.stdlib.default.dependency = false diff --git a/src/main/kotlin/platform/mixin/insight/MixinTargetLineMarkerProvider.kt b/src/main/kotlin/platform/mixin/insight/MixinTargetLineMarkerProvider.kt index f3a7e7343..28e07d161 100644 --- a/src/main/kotlin/platform/mixin/insight/MixinTargetLineMarkerProvider.kt +++ b/src/main/kotlin/platform/mixin/insight/MixinTargetLineMarkerProvider.kt @@ -28,7 +28,7 @@ import com.intellij.codeInsight.daemon.GutterIconNavigationHandler import com.intellij.codeInsight.daemon.LineMarkerInfo import com.intellij.codeInsight.daemon.LineMarkerProviderDescriptor import com.intellij.codeInsight.hint.HintManager -import com.intellij.codeInsight.navigation.NavigationUtil +import com.intellij.codeInsight.navigation.getPsiElementPopup import com.intellij.openapi.editor.markup.GutterIconRenderer import com.intellij.openapi.fileEditor.FileEditorManager import com.intellij.psi.PsiAnnotation @@ -111,10 +111,10 @@ class MixinTargetLineMarkerProvider : LineMarkerProviderDescriptor() { } else -> { if (editor != null) { - NavigationUtil.getPsiElementPopup(targets.toTypedArray(), "Choose Target") + getPsiElementPopup(targets.toTypedArray(), "Choose Target") .showInBestPositionFor(editor) } else { - NavigationUtil.getPsiElementPopup(targets.toTypedArray(), "Choose Target") + getPsiElementPopup(targets.toTypedArray(), "Choose Target") .show(RelativePoint(e)) } } diff --git a/src/main/kotlin/platform/sponge/inspection/SpongePluginClassInspection.kt b/src/main/kotlin/platform/sponge/inspection/SpongePluginClassInspection.kt index 4f08e4e42..eb68c96aa 100644 --- a/src/main/kotlin/platform/sponge/inspection/SpongePluginClassInspection.kt +++ b/src/main/kotlin/platform/sponge/inspection/SpongePluginClassInspection.kt @@ -90,7 +90,7 @@ class SpongePluginClassInspection : AbstractBaseJavaLocalInspectionTool() { classIdentifier, "Plugin class must have an empty constructor or an @Inject constructor.", ProblemHighlightType.GENERIC_ERROR, - AddDefaultConstructorFix(aClass), + AddDefaultConstructorFix(aClass).asQuickFix(), ) } } diff --git a/src/main/kotlin/util/class-utils.kt b/src/main/kotlin/util/class-utils.kt index d3f3799b6..18b5fd39f 100644 --- a/src/main/kotlin/util/class-utils.kt +++ b/src/main/kotlin/util/class-utils.kt @@ -22,7 +22,6 @@ package com.demonwav.mcdev.util import com.intellij.codeInsight.daemon.impl.quickfix.AddMethodFix import com.intellij.navigation.AnonymousElementProvider -import com.intellij.openapi.editor.Editor import com.intellij.openapi.project.Project import com.intellij.psi.CommonClassNames import com.intellij.psi.JavaPsiFacade @@ -30,7 +29,6 @@ import com.intellij.psi.PsiClass import com.intellij.psi.PsiClassType import com.intellij.psi.PsiElement import com.intellij.psi.PsiField -import com.intellij.psi.PsiFile import com.intellij.psi.PsiInvalidElementAccessException import com.intellij.psi.PsiJavaFile import com.intellij.psi.PsiMethod @@ -228,14 +226,7 @@ fun PsiClass.addImplements(qualifiedClassName: String) { * Adds the given method to this class, or its copy. Returns the method actually added */ fun PsiClass.addMethod(template: PsiMethod): PsiMethod? { - var theNewMethod: PsiMethod? = null - object : AddMethodFix(template, this) { - override fun postAddAction(file: PsiFile, editor: Editor?, newMethod: PsiMethod?) { - theNewMethod = newMethod - super.postAddAction(file, editor, newMethod) - } - }.applyFix() - return theNewMethod + return AddMethodFix(template, this).createMethod(this) } fun PsiClass.findMatchingMethod(