Affects Version/s: 1.8-beta-1
Fix Version/s: None
I've found some strange behaviour when dynamically overriding methods that are called in a class hierarchy, which I think might be a bug. The problem is that when I override a method on a subclass, code in the superclass still calls the original method (note all classes are Groovy ones, I know this wouldn't work with a Java class hierarchy).
I've isolated it to this sample code:
...which gives me the following output...
I would have expected that the dynamic version of internalMethod() would be called both times, given that Groovy has dynamic method dispatching.
Some discussion of this issue took place on the mailing list: http://old.nabble.com/Problems-using-metaClass-to-override-methods-in-class-hierarchy-td26743895.html#a26743895
The suggestion is that the CallSiteArray.createCallCurrentSite(...) method could check whether the receiver is a sub class of the sender class.