Lateinit property is not initialized when plugin starts in 2023.1 IDEA version
Answered
I wrote a plugin Git Branch Manager and it works correctly till 2023.1 version. After migrate to this version the exception occurs. During migration I've updated only versions, there are no changes in plugin code:
plugins {
id("org.jetbrains.intellij") version "1.13.3"
id("org.jetbrains.kotlin.jvm") version "1.8.21"
}
intellij {
version.set("2023.1")
}
Also plugin defined branchComboBox in a dialog file:
<component id="abf06" class="javax.swing.JComboBox" binding="branchComboBox">
and in kotlin:
class CheckoutBranchDialog(private val project: Project) : DialogWrapper(project) {
private lateinit var branchComboBox: JComboBox<String>
}
When test plugin and run(using run gradle task) it from Community edition it works as expected but when load jar file with plugin to Enterprise version it throws:
kotlin.UninitializedPropertyAccessException: lateinit property branchComboBox has not been initialized
at app.gui.CheckoutBranchDialog.initBranchComboBox(CheckoutBranchDialog.kt:61)
What could be wrong?
Please sign in to leave a comment.
You cannot use UI Designer with bound form written in Kotlin https://youtrack.jetbrains.com/issue/KTIJ-791.
Please switch to UI DSL https://plugins.jetbrains.com/docs/intellij/kotlin-ui-dsl-version-2.html or use Java.
interesting question, if I have not misunderstand , UI designer can not apply on Kotlin ? ( with XML style defination)
but I notice the code ‘https://github.com/vsigler/remote-log-console’
it use Kotlin + UI desginer (XML file ) create the toolWindow
It is wrong and not supported.