Details
-
Type:
Sub-task
-
Status:
Open
-
Priority:
Major
-
Resolution: Unresolved
-
Affects Version/s: 1.6-rc-3
-
Fix Version/s: None
-
Component/s: None
-
Labels:None
-
Environment:windows XP, sun jdk1.6
-
Number of attachments :
Description
StackOverflowError when mixin is called before instance creations (a and b) in case same mixin on two classes (linked by inheritance)
The script in attachement should be clear enough.
Here is a summary :
B extends A
XCategory is mixin to A and B
a instance of A and b instance of B
When the mixins are applied after the instance creations (as in comments), it works.
The stackoverflow indicates :
java.lang.StackOverflowError
at B.toString(ConsoleScript47:9)
at XCategory.toString(ConsoleScript47:15)
at B.toString(ConsoleScript47:9)
at XCategory.toString(ConsoleScript47:15)
Another point is how to have the following assert code working :
assert a.toString() == "XA"
assert b.toString() == "XBXA" // instead of "XBA"
Just want to add that with the classes A, B, XCategory as given in the original JIRA example, even if the mixin is done only on the sub class B, it reproduces the StackOverflowError
A.metaClass.mixin XCategory def b = new B() println b.toString()