Skip to content

[fix] runtime error exception when run in IntelliJ IDEA 2024.3 and also Android Studio Meerkat #443

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -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 {
Expand All @@ -11,15 +12,15 @@ 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"
}
group = "wu.seal"
version = System.getenv("TAG") ?: "Unreleased"

intellij {
version = "2017.1"
version = "2020.1"
pluginName = "JsonToKotlinClass"
}
tasks.patchPluginXml {
Expand Down Expand Up @@ -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
}
11 changes: 7 additions & 4 deletions src/main/kotlin/wu/seal/jsontokotlin/ui/JsonInputDialog.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()
}
})
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/META-INF/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
<!-- please see http://www.jetbrains.org/intellij/sdk/docs/basics/getting_started/plugin_compatibility.html
on how to target different products -->
<depends>com.intellij.modules.lang</depends>

<depends>com.intellij.modules.json</depends>
<extensions defaultExtensionNs="com.intellij">
<postStartupActivity implementation="wu.seal.jsontokotlin.JsonToKotlinApplication"/>
</extensions>
Expand Down
Loading