Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Won't Fix
-
1.0
-
None
-
None
-
all
Description
> I think there are two different issues here at hand. The first one is
> that the 'extending' class does not expose the static methods of the
> 'extended' class. And this is down to whether or not you want to
> support it. Personally I think this is a must, since so many utility
> classes would no longer be useful (at least on my work environment).
> The second issue is that the 'extending' class does not hide the
> 'extended' class' static method, and when invoking the method on the
> 'extending' class, the 'extended' class' method is invoked instead.
> This I think is a pretty huge bug.
> Non-static methods work fine, but static methods on the extending
> class are just ignored and hidden by the extended class (this should
> work the other way around).
> [[ EXAMPLE ]]
>
> Fruit.java:
> public class Fruit {
>
> public static void say()
>
> public void whisper()
>
> }
>
> Apple.java:
> public class Apple extends Fruit {
>
> public void whisper()
>
> public static void say()
> }
>
> script.groovy
> import Fruit;
> import Apple;
>
> println "The fruit says...";
> Fruit.say();
> println "The apple says...";
> Apple.say();
>
> Fruit fruit = new Fruit();
> Apple apple = new Apple();
>
> println "The fruit whispers...";
> fruit.whisper();
> println "The apple whispers...";
> apple.whisper();
>
> Output:
> The fruit says...
> I am a fruit...
> The apple says...
> I am a fruit...
> The fruit whispers...
> shhh.... I am a fruit....
> The apple whispers...
> shhh... I am an apple...