Skip to content

[GREENFOOT-170] If you make a World class that takes parameters, undescriptive exception is thrown

If you make a new World class which takes parameters then if Greenfoot tries to make an instance of that world the following exception is thrown:

{noformat} java.lang.InstantiationException: Test at java.lang.Class.newInstance0(Class.java:340) at java.lang.Class.newInstance(Class.java:308) at greenfoot.platforms.ide.WorldHandlerDelegateIDE.instantiateNewWorld(WorldHandlerDelegateIDE.java:400) at greenfoot.core.WorldHandler.instantiateNewWorld(WorldHandler.java:320) at greenfoot.gui.GreenfootFrame$3.run(GreenfootFrame.java:809) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209) at java.awt.EventQueue.dispatchEvent(EventQueue.java:597) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160) at java.awt.EventDispatchThread.run(EventDispatchThread.java:121) {noformat}

I can understand why this is thrown, however perhaps it should be more descriptive. Most people would not realize that it is because of their parameters on their World class.


Issue metadata

  • Issue type: Bug
  • Priority: Low
  • Fix versions: 1.5.2