[
https://issues.apache.org/jira/browse/GROOVY-3347?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Eric Milles updated GROOVY-3347:
--------------------------------
Labels: StackOverflowError (was: )
> strange behaviour with mixins before and after class instances
> --------------------------------------------------------------
>
> Key: GROOVY-3347
> URL: https://issues.apache.org/jira/browse/GROOVY-3347
> Project: Groovy
> Issue Type: Bug
> Components: groovy-runtime
> Affects Versions: 1.6-rc-3, 2.5.0-beta-1, 3.0.4
> Environment: windows XP, sun jdk1.6
> Reporter: Louis Foucart
> Priority: Major
> Labels: StackOverflowError
> Attachments: mixinBug.groovy
>
>
> 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"
--
This message was sent by Atlassian Jira
(v8.20.1#820001)