From 2b69e7ffd3e5188abf7cfec539492b7ab9fa9710 Mon Sep 17 00:00:00 2001 From: Seal Date: Tue, 3 Dec 2024 12:13:53 +0400 Subject: [PATCH] [fix] runtime error exception when run in IntelliJ IDEA 2024.3 and also Android Studio Meerkat --- build.gradle.kts | 13 +++++++++++-- .../wu/seal/jsontokotlin/ui/JsonInputDialog.kt | 11 +++++++---- src/main/resources/META-INF/plugin.xml | 2 +- 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 098f9394..cda8db86 100755 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,6 +1,7 @@ import org.hildan.github.changelog.builder.DEFAULT_TIMEZONE import org.hildan.github.changelog.builder.SectionDefinition import org.jetbrains.changelog.closure +import org.jetbrains.kotlin.gradle.tasks.KotlinCompile buildscript { repositories { @@ -11,7 +12,7 @@ buildscript { plugins { id("org.jetbrains.intellij") version "0.7.3" - kotlin("jvm") version "1.4.20" + kotlin("jvm") version "1.5.20" id("org.jetbrains.changelog") version "1.1.1" id("org.hildan.github.changelog") version "1.6.0" } @@ -19,7 +20,7 @@ group = "wu.seal" version = System.getenv("TAG") ?: "Unreleased" intellij { - version = "2017.1" + version = "2020.1" pluginName = "JsonToKotlinClass" } tasks.patchPluginXml { @@ -93,3 +94,11 @@ task("createGithubReleaseNotes") { githubReleaseNoteFile.writeText(content) } } +tasks.withType(KotlinCompile::class.java).configureEach { + kotlinOptions { + jvmTarget = "1.8" // Set the JVM target to match the bytecode you are inlining + } +} +tasks.buildSearchableOptions { + enabled = false +} \ No newline at end of file diff --git a/src/main/kotlin/wu/seal/jsontokotlin/ui/JsonInputDialog.kt b/src/main/kotlin/wu/seal/jsontokotlin/ui/JsonInputDialog.kt index 886e31c3..29022cdd 100755 --- a/src/main/kotlin/wu/seal/jsontokotlin/ui/JsonInputDialog.kt +++ b/src/main/kotlin/wu/seal/jsontokotlin/ui/JsonInputDialog.kt @@ -8,6 +8,8 @@ import com.intellij.openapi.application.ApplicationManager import com.intellij.openapi.application.runWriteAction import com.intellij.openapi.editor.Editor import com.intellij.openapi.editor.EditorFactory +import com.intellij.openapi.editor.event.DocumentEvent +import com.intellij.openapi.editor.event.DocumentListener import com.intellij.openapi.fileChooser.FileChooser import com.intellij.openapi.fileChooser.FileChooserDescriptor import com.intellij.openapi.progress.util.DispatchThreadProgressWindow @@ -140,10 +142,11 @@ class JsonInputDialog(classsName: String, private val project: Project) : Messag val editorFactory = EditorFactory.getInstance() val document = editorFactory.createDocument("").apply { setReadOnly(false) - addDocumentListener(object : com.intellij.openapi.editor.event.DocumentListener { - override fun documentChanged(event: com.intellij.openapi.editor.event.DocumentEvent?) = revalidate() - - override fun beforeDocumentChange(event: com.intellij.openapi.editor.event.DocumentEvent?) = Unit + addDocumentListener(object : DocumentListener { + override fun documentChanged(event: DocumentEvent) { + super.documentChanged(event) + revalidate() + } }) } diff --git a/src/main/resources/META-INF/plugin.xml b/src/main/resources/META-INF/plugin.xml index e3426b4e..0caf4772 100755 --- a/src/main/resources/META-INF/plugin.xml +++ b/src/main/resources/META-INF/plugin.xml @@ -55,7 +55,7 @@ com.intellij.modules.lang - + com.intellij.modules.json