groovy-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From François Guillot <francoisguillo...@gmail.com>
Subject Re: Compile error with 2.4.10
Date Wed, 22 Mar 2017 13:29:03 GMT
Hi Paul,

Thanks. I removed a bunch of 'final' in the Trait and dependents classes
and it seems to work.

Created https://issues.apache.org/jira/browse/GROOVY-8127 as well

Cheers,
François



2017-03-22 14:08 GMT+01:00 Paul King <paulk@asert.com.au>:

> The method that throws that error hasn't changed recently but it looks
> like another case that isn't handled correctly with final fields in a
> trait. I'll have to investigate further to be sure. Can you create a
> Jira issue?
>
> Workaround would be to remove the final for now.
>
> Cheers, Paul.
>
> On Wed, Mar 22, 2017 at 10:38 PM, François Guillot
> <francoisguillot73@gmail.com> wrote:
> > H,
> >
> > I'm switching from Groovy 2.4.7 to 2.4.10 in my project.
> >
> > I have a compile error with 2.4.10.
> > Simplified example:
> > <<
> >
> > import groovy.transform.CompileStatic
> > import org.junit.Rule
> > import org.junit.rules.TestRule
> >
> > @CompileStatic
> > trait FooTrait {
> >
> >     @Rule
> >     public final TestRule foo = {} as TestRule
> >
> > }
> >
> >>>
> >
> > I get "Error:Groovyc: Access to
> > com.gradle.ratpack.test.FooTrait$Trait$Helper#$self is forbidden"
> >
> > Another variant of this error is "Error:Groovyc: Apparent variable
> '$self'
> > was found in a static scope but doesn't refer to a local variable, static
> > field or class."
> >
> > Is there sth I need to change, or is there a workaround ?
> >
> > Thanks,
> >
> > François
>

Mime
View raw message