Hi folks,
having come to Javaranch to look up some Jython information I encountered Groovy for the first time and thought I'd have a play with it. I have to say, as a
java programmer it is much more intuitive than Jython and I like it a lot. The only problem I have encountered so far is that it doesn't appear to allow me to program to an interface.
I'm using Eclipse 3.1 and wrote something along the lines of
myInterface x;
x = new ParentClass();
x.printMessage();
x = new ChildClass();
x.printMessage();
Which resulted in the following error message "The name x does not refer to a declared variable or class."
ParentClass implements myInterface and ChildClass extends ParentClass and overrides printMessage().
When I cut and paste the code into a java project it compiled fine.
Changing the declaration to
ParentClass x=new ParentClass();
ChildClass y = new ChildClass();
made Groovy happy.
Am I doing something stupid or is this not supported by Groovy yet.
Thanks.