You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Sep 28, 2024. It is now read-only.
I ran into the following ClassCastException with Kotlin 1.4 and an ItemViewModel. java.lang.ClassCastException: class tornadofx.BindingAwareSimpleDoubleProperty cannot be cast to class javafx.beans.property.ObjectProperty
It seems the new type interference algorithm chooses different types when binding compared to Kotlin 1.3.
An example to reproduce the exception:
import tornadofx.*
class LimitsConfigTestView : View("Limits Configuration") {
private val limits = LimitsTest()
private val viewmodel = LimitsTestViewModel(limits)
override val root = vbox {
form {
fieldset {
field {
textfield() {
bind(viewmodel.errorMaxSpeed)
}
}
}
}
}
}
class LimitsTest {
var errorMaxSpeed: Double by property(0.0)
fun errorMaxSpeedProperty() = getProperty(LimitsTest::errorMaxSpeed)
}
class LimitsTestViewModel(limits: LimitsTest) : ItemViewModel<LimitsTest>(limits) {
val errorMaxSpeed = bind(LimitsTest::errorMaxSpeedProperty)
}
With kotlin 1.3, the bind in the view model is inferred as bind<Double, Property<Double>, Property<Double>>(LimitsTest::errorMaxSpeedProperty)
while kotlin 1.4 infers as bind<Double, ObjectProperty<Double>, ObjectProperty<Double>>(LimitsTest::errorMaxSpeedProperty)
I ran into the following ClassCastException with Kotlin 1.4 and an ItemViewModel.
java.lang.ClassCastException: class tornadofx.BindingAwareSimpleDoubleProperty cannot be cast to class javafx.beans.property.ObjectProperty
It seems the new type interference algorithm chooses different types when binding compared to Kotlin 1.3.
An example to reproduce the exception:
With kotlin 1.3, the bind in the view model is inferred as
bind<Double, Property<Double>, Property<Double>>(LimitsTest::errorMaxSpeedProperty)
while kotlin 1.4 infers as
bind<Double, ObjectProperty<Double>, ObjectProperty<Double>>(LimitsTest::errorMaxSpeedProperty)
Details:
TornadoFX: no.tornado:tornadofx:2.0.0-SNAPSHOT
Kotlin: 1.4.10
JVM:
The text was updated successfully, but these errors were encountered: