Skip to content
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

ClassCastException when upgrading to Kotlin 1.4 #12

Open
xeruf opened this issue Oct 28, 2020 · 1 comment
Open

ClassCastException when upgrading to Kotlin 1.4 #12

xeruf opened this issue Oct 28, 2020 · 1 comment

Comments

@xeruf
Copy link

xeruf commented Oct 28, 2020

When executing ./gradlew run in our project on this commit and pressing "Neues Spiel starten" in the GUI, the following error occurs. The commit after that downgrades Kotlin, and the error vanishes.

Oct 28, 2020 1:55:30 P.M. tornadofx.DefaultErrorHandler uncaughtException
SEVERE: Uncaught error
java.lang.ClassCastException: class tornadofx.BindingAwareSimpleStringProperty cannot be cast to class javafx.beans.property.ObjectProperty (tornadofx.BindingAwareSimpleStringProperty is in unnamed module of loader 'app'; javafx.beans.property.ObjectProperty is in module javafx.base of loader 'app')
	at sc.gui.model.TeamSettingsModel.<init>(GameCreationModel.kt:48)
	at sc.gui.controller.GameCreationController.<init>(GameCreationController.kt:16)
	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:500)
	at java.base/java.lang.reflect.ReflectAccess.newInstance(ReflectAccess.java:124)
	at java.base/jdk.internal.reflect.ReflectionFactory.newInstance(ReflectionFactory.java:346)
	at java.base/java.lang.Class.newInstance(Class.java:604)
	at tornadofx.FXKt.find(FX.kt:437)
	at sc.gui.view.GameCreationView$$special$$inlined$inject$2.getValue(Component.kt:1364)
	at sc.gui.view.GameCreationView$$special$$inlined$inject$2.getValue(Component.kt:212)
	at sc.gui.view.GameCreationView.getController(GameCreationView.kt)
	at sc.gui.view.GameCreationView$root$1$2$1$1.invoke(GameCreationView.kt:25)
	at sc.gui.view.GameCreationView$root$1$2$1$1.invoke(GameCreationView.kt:14)
	at tornadofx.LayoutsKt.vbox(Layouts.kt:433)
	at tornadofx.LayoutsKt.vbox$default(Layouts.kt:144)
	at sc.gui.view.GameCreationView$root$1$2$1.invoke(GameCreationView.kt:24)
	at sc.gui.view.GameCreationView$root$1$2$1.invoke(GameCreationView.kt:14)
	at tornadofx.LayoutsKt.hbox(Layouts.kt:429)
	at tornadofx.LayoutsKt.hbox$default(Layouts.kt:137)
	at sc.gui.view.GameCreationView$root$1$2.invoke(GameCreationView.kt:23)
	at sc.gui.view.GameCreationView$root$1$2.invoke(GameCreationView.kt:14)
	at tornadofx.FormsKt.form(Forms.kt:342)
	at sc.gui.view.GameCreationView$root$1.invoke(GameCreationView.kt:22)
	at sc.gui.view.GameCreationView$root$1.invoke(GameCreationView.kt:14)
	at tornadofx.LayoutsKt.borderpane(Layouts.kt:465)
	at sc.gui.view.GameCreationView.<init>(GameCreationView.kt:18)
	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:500)
	at java.base/java.lang.reflect.ReflectAccess.newInstance(ReflectAccess.java:124)
	at java.base/jdk.internal.reflect.ReflectionFactory.newInstance(ReflectionFactory.java:346)
	at java.base/java.lang.Class.newInstance(Class.java:604)
	at tornadofx.FXKt.find(FX.kt:437)
	at tornadofx.FXKt.find$default(FX.kt:426)
	at tornadofx.UIComponent.replaceWith(Component.kt:1259)
	at tornadofx.UIComponent.replaceWith$default(Component.kt:1258)
	at sc.gui.controller.AppController.changeViewTo(AppController.kt:16)
	at sc.gui.view.StartView$root$1$1$2$1$1.handle(StartView.kt:29)
	at sc.gui.view.StartView$root$1$1$2$1$1.handle(StartView.kt:9)
	at javafx.base/com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:86)
	at javafx.base/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238)
	at javafx.base/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
	at javafx.base/com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
	at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
	at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
	at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
	at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
	at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
	at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
	at javafx.base/com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
	at javafx.base/com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:54)
	at javafx.base/javafx.event.Event.fireEvent(Event.java:198)
	at javafx.graphics/javafx.scene.Scene$ClickGenerator.postProcess(Scene.java:3569)
	at javafx.graphics/javafx.scene.Scene$MouseHandler.process(Scene.java:3871)
	at javafx.graphics/javafx.scene.Scene.processMouseEvent(Scene.java:1849)
	at javafx.graphics/javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:2590)
	at javafx.graphics/com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:409)
	at javafx.graphics/com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:299)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:391)
	at javafx.graphics/com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$handleMouseEvent$2(GlassViewEventHandler.java:447)
	at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(QuantumToolkit.java:412)
	at javafx.graphics/com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(GlassViewEventHandler.java:446)
	at javafx.graphics/com.sun.glass.ui.View.handleMouseEvent(View.java:556)
	at javafx.graphics/com.sun.glass.ui.View.notifyMouse(View.java:942)
	at javafx.graphics/com.sun.glass.ui.gtk.GtkApplication._runLoop(Native Method)
	at javafx.graphics/com.sun.glass.ui.gtk.GtkApplication.lambda$runLoop$11(GtkApplication.java:277)
	at java.base/java.lang.Thread.run(Thread.java:832)
@xeruf
Copy link
Author

xeruf commented Dec 1, 2020

Worked around it by explicitly declaring the type of the binding result as Property after seeing edvin/tornadofx#1285

xeruf added a commit to software-challenge/gui that referenced this issue Dec 1, 2020
Worked around edvin/tornadofx2#12
by explicitly declaring bind return types
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant