From e1caeade8a83e9422565681749dad4175a853c9c Mon Sep 17 00:00:00 2001 From: Victor Kropp Date: Thu, 7 Nov 2024 15:40:56 +0100 Subject: [PATCH] CMP-6806 fix warnings and deprecations --- .../desktop/ui/tooling/preview/rpc/PreviewManager.kt | 2 +- .../desktop/ui/tooling/preview/rpc/RemotePreviewHost.kt | 4 ++-- idea-plugin/.gitignore | 3 ++- idea-plugin/build.gradle.kts | 7 ++++++- .../compose/desktop/ide/preview/PreviewToolWindow.kt | 3 --- 5 files changed, 11 insertions(+), 8 deletions(-) diff --git a/gradle-plugins/preview-rpc/src/main/kotlin/org/jetbrains/compose/desktop/ui/tooling/preview/rpc/PreviewManager.kt b/gradle-plugins/preview-rpc/src/main/kotlin/org/jetbrains/compose/desktop/ui/tooling/preview/rpc/PreviewManager.kt index 7e5309e74b..032330c120 100644 --- a/gradle-plugins/preview-rpc/src/main/kotlin/org/jetbrains/compose/desktop/ui/tooling/preview/rpc/PreviewManager.kt +++ b/gradle-plugins/preview-rpc/src/main/kotlin/org/jetbrains/compose/desktop/ui/tooling/preview/rpc/PreviewManager.kt @@ -290,7 +290,7 @@ class PreviewManagerImpl( } } }.also { - it.uncaughtExceptionHandler = Thread.UncaughtExceptionHandler { thread, e -> + it.uncaughtExceptionHandler = Thread.UncaughtExceptionHandler { _, e -> onError(e) } threads.add(it) diff --git a/gradle-plugins/preview-rpc/src/main/kotlin/org/jetbrains/compose/desktop/ui/tooling/preview/rpc/RemotePreviewHost.kt b/gradle-plugins/preview-rpc/src/main/kotlin/org/jetbrains/compose/desktop/ui/tooling/preview/rpc/RemotePreviewHost.kt index 8d96ab8b16..cb3ebc40dd 100644 --- a/gradle-plugins/preview-rpc/src/main/kotlin/org/jetbrains/compose/desktop/ui/tooling/preview/rpc/RemotePreviewHost.kt +++ b/gradle-plugins/preview-rpc/src/main/kotlin/org/jetbrains/compose/desktop/ui/tooling/preview/rpc/RemotePreviewHost.kt @@ -101,7 +101,7 @@ internal class PreviewHost(private val log: PreviewLogger, connection: RemoteCon }.setUpUnhandledExceptionHandler(ExitCodes.RECEIVER_FATAL_ERROR) private fun Thread.setUpUnhandledExceptionHandler(exitCode: Int): Thread = apply { - uncaughtExceptionHandler = Thread.UncaughtExceptionHandler { t, e -> + uncaughtExceptionHandler = Thread.UncaughtExceptionHandler { _, e -> try { System.err.println() System.err.println(PREVIEW_START_OF_STACKTRACE_MARKER) @@ -151,7 +151,7 @@ internal class PreviewHost(private val log: PreviewLogger, connection: RemoteCon val possibleCandidates = previewFacade.methods.filter { it.name == "render" } throw RuntimeException("Could not find method '$signature'. Possible candidates: \n${possibleCandidates.joinToString("\n") { "* ${it}" }}", e) } - val (id, fqName, frameConfig) = request + val (_, fqName, frameConfig) = request val scaledWidth = frameConfig.scaledWidth val scaledHeight = frameConfig.scaledHeight val scale = frameConfig.scale diff --git a/idea-plugin/.gitignore b/idea-plugin/.gitignore index 7c0a052ec7..00fa5ce75e 100644 --- a/idea-plugin/.gitignore +++ b/idea-plugin/.gitignore @@ -1,3 +1,4 @@ build/ .gradle/ -.idea \ No newline at end of file +.idea +.intellijPlatform \ No newline at end of file diff --git a/idea-plugin/build.gradle.kts b/idea-plugin/build.gradle.kts index 3c2d343e0f..c199720b35 100644 --- a/idea-plugin/build.gradle.kts +++ b/idea-plugin/build.gradle.kts @@ -26,6 +26,7 @@ dependencies { intellijPlatform { intellijIdeaCommunity(libs.versions.idea) instrumentationTools() + pluginVerifier() bundledPlugins("com.intellij.java", "org.jetbrains.kotlin", "com.intellij.gradle") } @@ -41,7 +42,11 @@ intellijPlatform { channels = projectProperties.pluginChannels } - pluginVerification { ides { recommended() } } + pluginVerification { + ides { + recommended() + } + } } tasks { diff --git a/idea-plugin/src/main/kotlin/org/jetbrains/compose/desktop/ide/preview/PreviewToolWindow.kt b/idea-plugin/src/main/kotlin/org/jetbrains/compose/desktop/ide/preview/PreviewToolWindow.kt index 278310b618..d4c0606b22 100644 --- a/idea-plugin/src/main/kotlin/org/jetbrains/compose/desktop/ide/preview/PreviewToolWindow.kt +++ b/idea-plugin/src/main/kotlin/org/jetbrains/compose/desktop/ide/preview/PreviewToolWindow.kt @@ -15,9 +15,6 @@ import java.awt.BorderLayout import org.jetbrains.compose.desktop.ide.preview.ui.PreviewPanel class PreviewToolWindow : ToolWindowFactory, DumbAware { - @Deprecated("Use isApplicableAsync") - override fun isApplicable(project: Project): Boolean = isPreviewCompatible(project) - override suspend fun isApplicableAsync(project: Project): Boolean = isPreviewCompatible(project) override fun init(toolWindow: ToolWindow) {