You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Pascal Schumacher (JIRA)" <ji...@apache.org> on 2015/07/08 18:12:05 UTC

[jira] [Updated] (GROOVY-3347) strange behaviour with mixins before and after class instances

     [ https://issues.apache.org/jira/browse/GROOVY-3347?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Pascal Schumacher updated GROOVY-3347:
--------------------------------------
    Affects Version/s: 2.5.0-beta-1

> 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
>         Environment: windows XP, sun jdk1.6
>            Reporter: Louis Foucart
>         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
(v6.3.4#6332)