You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@groovy.apache.org by François Guillot <fr...@gmail.com> on 2017/03/22 12:38:02 UTC
Compile error with 2.4.10
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
RE: Compile error with 2.4.10
Posted by "Wagih, Sameh" <sw...@ictsi.com>.
Dear all .,
I am currently looking for Groovy Developer to join our team.
The requirements are as per attached.
Work could be done remotely as well. So it is not a must that he reside in Manila.
If you are interested please contact me via Email.
From: François Guillot [mailto:francoisguillot73@gmail.com]
Sent: Wednesday, March 22, 2017 8:38 PM
To: users@groovy.apache.org
Subject: Compile error with 2.4.10
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
ICTSI EMAIL DISCLAIMER
________________________________
This communication is intended only for the use of the individual or entity to whom it is addressed. It may contain confidential or legally privileged information. If you are not the intended recipient you are notified that disclosing, copying, distributing or taking action in reliance on the contents of this communication is strictly prohibited and may be unlawful. If you have received it by mistake, please notify us immediately by e-mail reply and delete it from your system.
Re: Compile error with 2.4.10
Posted by François Guillot <fr...@gmail.com>.
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 <pa...@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
> <fr...@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
>
Re: Compile error with 2.4.10
Posted by Paul King <pa...@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
<fr...@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