This site requires JavaScript, please enable it in your browser!
Greenfoot back
adagio_burner
adagio_burner wrote ...

2016/11/26

MyWorld cannot be cast to MyWorld

adagio_burner adagio_burner

2016/11/26

#
Here is the error I see quite often. Looks like a bug to me. java.lang.ClassCastException: MyWorld cannot be cast to MyWorld at __SHELL2.run(__SHELL2.java:5) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at greenfoot.localdebugger.LocalDebugger$QueuedExecution.run(LocalDebugger.java:271) at greenfoot.core.Simulation.runQueuedTasks(Simulation.java:502) at greenfoot.core.Simulation.maybePause(Simulation.java:305) at greenfoot.core.Simulation.runContent(Simulation.java:218) at greenfoot.core.Simulation.run(Simulation.java:211) I cannot repro it with 100% consistency, but I usually see that when I switch from code to the world view and right-click to test-execute a method. I am teaching a group of kids and somebody would have that occur to them at least once or twice during the class. The only cure it to restart Greenfoot.
Super_Hippo Super_Hippo

2016/11/26

#
Could you show the code which is involved? The error message seems to be a bit weird indeed.
adagio_burner adagio_burner

2016/11/27

#
I get it with different project, invoking different methods and on different machines. The trick seems to be in timing when I right-click on the world. From time to time instead of seeing the method I picked being invoked I see this, and after that, a restart is needed.
fejfo fejfo

2016/11/28

#
It this case the greenfoot version is probably important too.
adagio_burner adagio_burner

2016/12/2

#
3.0.4, the latest
You need to login to post a reply.