Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
1.8.2
-
None
Description
The following code will generate a StackOverflowError. It seems "setMetaClass(MetaClass)" is called recursivly, although "super.setMetaClass(MetaClass)" is used. Note that this problem only occures when "Test" has no base class.
class Test { void setMetaClass(MetaClass metaClass) { super.setMetaClass(metaClass) } } def obj = new Test() obj.metaClass = obj.metaClass
On the other hand, the following code works just fine:
class Base {} class Test extends Base { void setMetaClass(MetaClass metaClass) { super.setMetaClass(metaClass) } } def obj = new Test() obj.metaClass = obj.metaClass