groovy-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul King <pa...@asert.com.au>
Subject Re: Compile error with 2.4.10
Date Wed, 22 Mar 2017 13:08:14 GMT
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