groovy-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dogbert <virtualdogb...@gmail.com>
Subject Re: Question about AST Transforms and @DelegatesTo
Date Mon, 05 Sep 2016 13:40:13 GMT
After thinking about my own question and looking at it, I don't think it is
possible, because of timing. Even if I could create a version of @DelegatesTo
that could be applied to the parameters of an AST Transform(which are
methods), the class that I would want to delegate to wouldn't be compiled
yet, and I don't think it could be because it's a Grails service.  If you
can confirm what I'm thinking, I'm misunderstanding something, or there is
another way around this, that you can think of,  let me know.

Thanks,
Tucker

On Fri, Sep 2, 2016 at 8:41 AM, Dogbert <virtualdogbert@gmail.com> wrote:

> So I have a question about AST Transforms and @DelegatesTo, as it would
> relate to AST transforms in a Grails plugin I wrote:
> https://github.com/virtualdogbert/Enforcer
>
> I don't think I can use @DelegatesTo as is, but, if I could figure out how
> it works, could I write a new version of @DelegatesTo, that I could apply
> to the parameters of an AST transform like:
>
> https://github.com/virtualdogbert/Enforcer/blob/master/src/
> main/groovy/com/virtualdogbert/ast/Enforce.groovy
>
> https://github.com/virtualdogbert/Enforcer/blob/master/src/
> main/groovy/com/virtualdogbert/ast/EnforceASTTransformation.groovy
>
> So that I could convince an IDE like intellij that those closure
> parameters delegate to a service class, so that when I use methods from
> that service class or it's traits, the IDE wont mark them as unresolved.
>
> Thank you for reading, and any help or direction you might provide.
>
> -Tucker
>

Mime
View raw message