Skip to content

Commit 0b0ed5b

Browse files
authored
Merge pull request #443 from wuseal/fix-compatible
[fix] runtime error exception when run in IntelliJ IDEA 2024.3 and also Android Studio Meerkat
2 parents 689dbb6 + 2b69e7f commit 0b0ed5b

File tree

3 files changed

+19
-7
lines changed

3 files changed

+19
-7
lines changed

build.gradle.kts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import org.hildan.github.changelog.builder.DEFAULT_TIMEZONE
22
import org.hildan.github.changelog.builder.SectionDefinition
33
import org.jetbrains.changelog.closure
4+
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
45

56
buildscript {
67
repositories {
@@ -11,15 +12,15 @@ buildscript {
1112

1213
plugins {
1314
id("org.jetbrains.intellij") version "0.7.3"
14-
kotlin("jvm") version "1.4.20"
15+
kotlin("jvm") version "1.5.20"
1516
id("org.jetbrains.changelog") version "1.1.1"
1617
id("org.hildan.github.changelog") version "1.6.0"
1718
}
1819
group = "wu.seal"
1920
version = System.getenv("TAG") ?: "Unreleased"
2021

2122
intellij {
22-
version = "2017.1"
23+
version = "2020.1"
2324
pluginName = "JsonToKotlinClass"
2425
}
2526
tasks.patchPluginXml {
@@ -93,3 +94,11 @@ task("createGithubReleaseNotes") {
9394
githubReleaseNoteFile.writeText(content)
9495
}
9596
}
97+
tasks.withType(KotlinCompile::class.java).configureEach {
98+
kotlinOptions {
99+
jvmTarget = "1.8" // Set the JVM target to match the bytecode you are inlining
100+
}
101+
}
102+
tasks.buildSearchableOptions {
103+
enabled = false
104+
}

src/main/kotlin/wu/seal/jsontokotlin/ui/JsonInputDialog.kt

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ import com.intellij.openapi.application.ApplicationManager
88
import com.intellij.openapi.application.runWriteAction
99
import com.intellij.openapi.editor.Editor
1010
import com.intellij.openapi.editor.EditorFactory
11+
import com.intellij.openapi.editor.event.DocumentEvent
12+
import com.intellij.openapi.editor.event.DocumentListener
1113
import com.intellij.openapi.fileChooser.FileChooser
1214
import com.intellij.openapi.fileChooser.FileChooserDescriptor
1315
import com.intellij.openapi.progress.util.DispatchThreadProgressWindow
@@ -140,10 +142,11 @@ class JsonInputDialog(classsName: String, private val project: Project) : Messag
140142
val editorFactory = EditorFactory.getInstance()
141143
val document = editorFactory.createDocument("").apply {
142144
setReadOnly(false)
143-
addDocumentListener(object : com.intellij.openapi.editor.event.DocumentListener {
144-
override fun documentChanged(event: com.intellij.openapi.editor.event.DocumentEvent?) = revalidate()
145-
146-
override fun beforeDocumentChange(event: com.intellij.openapi.editor.event.DocumentEvent?) = Unit
145+
addDocumentListener(object : DocumentListener {
146+
override fun documentChanged(event: DocumentEvent) {
147+
super.documentChanged(event)
148+
revalidate()
149+
}
147150
})
148151
}
149152

src/main/resources/META-INF/plugin.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
<!-- please see http://www.jetbrains.org/intellij/sdk/docs/basics/getting_started/plugin_compatibility.html
5656
on how to target different products -->
5757
<depends>com.intellij.modules.lang</depends>
58-
58+
<depends>com.intellij.modules.json</depends>
5959
<extensions defaultExtensionNs="com.intellij">
6060
<postStartupActivity implementation="wu.seal.jsontokotlin.JsonToKotlinApplication"/>
6161
</extensions>

0 commit comments

Comments
 (0)