[GREENFOOT-88] Class cast exception when using object from world as parameters for methods
Probably has to do with class reloading.
Steps to reproduce:
Load the standard wombats scenario.
Compile All
Add this method to Wombat: public void eatLeaf(Actor leaf) { if(leaf != null && leaf instanceof Leaf) { // eat the leaf... getWorld().removeObject(leaf); leavesEaten = leavesEaten + 1; } }
Compile Wombat via the EDITOR.
Compile World via the EDITOR.
SHIFT-add wombat to the world
SHIFT-add leaf to the world
Interactively invoke eatLeaf(Leaf) on the wombat
Click the leaf in the world.
Press OK to execute the method.
You will then get a class cast exception: java.lang.ClassCastException: Wombat cannot be cast to Wombat
Issue metadata
- Issue type: Bug
- Priority: Low
- Fix versions: 1.4.0