You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Eric Milles (Jira)" <ji...@apache.org> on 2024/01/30 23:34:00 UTC

[jira] [Resolved] (GROOVY-7984) @SelfType does not allow trait to be added dynamically

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

Eric Milles resolved GROOVY-7984.
---------------------------------
    Fix Version/s: 5.0.0-alpha-6
       Resolution: Fixed

https://github.com/apache/groovy/commit/7b2205df0ed21bcdfa3ff57777ea1f0fdcaa7d5b

> @SelfType does not allow trait to be added dynamically
> ------------------------------------------------------
>
>                 Key: GROOVY-7984
>                 URL: https://issues.apache.org/jira/browse/GROOVY-7984
>             Project: Groovy
>          Issue Type: Bug
>          Components: Compiler
>    Affects Versions: 2.4.3, 2.4.4, 2.4.5, 2.4.6, 2.4.7
>         Environment: windows 7, java 8, groovy script
>            Reporter: Denis Jouvin
>            Assignee: Eric Milles
>            Priority: Major
>              Labels: trait, traits
>             Fix For: 5.0.0-alpha-6
>
>
> When trying to add dynamically a trait T with a SelfType type restriction on class C, to an instance of that class C, the script throws : 
> org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast object 'C@92dae4' with class 'C' to class 'T'



--
This message was sent by Atlassian Jira
(v8.20.10#820010)