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

Kamal Advani updated GROOVY-7950:
---------------------------------
    Description: 
I can't find anything about this in 
http://docs.groovy-lang.org/next/html/documentation/core-traits.html -- 
apologies if I missed it elsewhere. Also could not find a similar issue.

I am applying a transform that references properties in a class, the 
transformed class also implements a trait with properties. It seems that the 
trait transform is applied last, such that the annotation-driven AST transforms 
don't see 'inherited/mixed in' trait properties.

{code}
import groovy.transform.*

trait T {
    String s1
}

@TupleConstructor(includes='s1, s2') // only a constructor for s2 created, same 
applies to @EqualsAndHashCode for example.
// @Sortable(includes='s1, s2') //  Error during @Sortable processing: tried to 
include unknown property 's1'
class Bar implements T {
    String s2
}
{code}

This 
http://docs.groovy-lang.org/next/html/documentation/core-traits.html#_compatibility_with_ast_transformations
 talks about applying transforms on a trait itself, but as per above, this 
isn't what I'm doing.

Is this behaviour by design, or am I missing something obvious? 

Thanks for your help.

  was:
I can't find anything about this in 
http://docs.groovy-lang.org/next/html/documentation/core-traits.html -- 
apologies if I missed it elsewhere. Also could not find a similar issue.

I am applying a transform that references properties to a class that also 
implements a trait with with properties. It seems that the trait transform is 
applied last, such that the annotation-driven AST transforms don't see 
'inherited/mixed in' trait properties.

{code}
import groovy.transform.*

trait T {
    String s1
}

@TupleConstructor(includes='s1, s2') // only a constructor for s2 created, same 
applies to @EqualsAndHashCode for example.
// @Sortable(includes='s1, s2') //  Error during @Sortable processing: tried to 
include unknown property 's1'
class Bar implements T {
    String s2
}
{code}

This 
http://docs.groovy-lang.org/next/html/documentation/core-traits.html#_compatibility_with_ast_transformations
 talks about applying transforms on a trait itself, but as per above, this 
isn't what I'm doing.

Is this behaviour by design, or am I missing something obvious? 

Thanks for your help.


> AST transforms referencing on a class not detecting Trait-mixed in properties
> -----------------------------------------------------------------------------
>
>                 Key: GROOVY-7950
>                 URL: https://issues.apache.org/jira/browse/GROOVY-7950
>             Project: Groovy
>          Issue Type: Bug
>          Components: ast builder
>    Affects Versions: 2.4.7
>            Reporter: Kamal Advani
>
> I can't find anything about this in 
> http://docs.groovy-lang.org/next/html/documentation/core-traits.html -- 
> apologies if I missed it elsewhere. Also could not find a similar issue.
> I am applying a transform that references properties in a class, the 
> transformed class also implements a trait with properties. It seems that the 
> trait transform is applied last, such that the annotation-driven AST 
> transforms don't see 'inherited/mixed in' trait properties.
> {code}
> import groovy.transform.*
> trait T {
>     String s1
> }
> @TupleConstructor(includes='s1, s2') // only a constructor for s2 created, 
> same applies to @EqualsAndHashCode for example.
> // @Sortable(includes='s1, s2') //  Error during @Sortable processing: tried 
> to include unknown property 's1'
> class Bar implements T {
>     String s2
> }
> {code}
> This 
> http://docs.groovy-lang.org/next/html/documentation/core-traits.html#_compatibility_with_ast_transformations
>  talks about applying transforms on a trait itself, but as per above, this 
> isn't what I'm doing.
> Is this behaviour by design, or am I missing something obvious? 
> Thanks for your help.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to