[
https://issues.apache.org/jira/browse/GROOVY-9215?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16906517#comment-16906517
]
Grant Haywood edited comment on GROOVY-9215 at 8/13/19 7:13 PM:
----------------------------------------------------------------
Never mind this comment was about my scoping error
was (Author: cinterloper):
[~daniel_sun]
I have removed
{code:java}
@TypeChecked{code}
from my application, however now I have encountered a new broken aspect of
CompileStatic
{code:java}
import groovy.transform.CompileStatic
@CompileStatic
class NewProblem {
public class Thing {
void setup(String s) {println s}
}
void aFunc(Closure c) {
c()
}
public Thing t = new Thing()
NewProblem() {
aFunc({
this.t.setup(" ")
})
}
}{code}
Compiling the above script produces the following error:
{code:java}
$ groovy-3.0.0-beta-3/bin/groovy
groovy_bug_example/src/main/groovy/NewProblem.groovy
groovy_bug_example/src/main/groovy/NewProblem.groovy
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
/home/g/cinterepo/code/groovy_bug_example/src/main/groovy/NewProblem.groovy:
19: Access to NewProblem#this is forbidden @ line 19, column 13.
this.t.setup(" ")
^
1 error
{code}
> Incorrect compile time access error is raised when using @CompileStatic
> and/or @TypeChecked
> -------------------------------------------------------------------------------------------
>
> Key: GROOVY-9215
> URL: https://issues.apache.org/jira/browse/GROOVY-9215
> Project: Groovy
> Issue Type: Bug
> Components: Static compilation, Static Type Checker
> Affects Versions: 3.0.0-beta-1, 3.0.0-beta-2, 3.0.0-beta-3
> Reporter: Grant Haywood
> Priority: Major
>
> after 3.0.0-beta-1 was released, my project will no longer compile (it would
> compile against alpha-4)
> Most of the classes are annotated with
> {code:java}
> @TypeChecked
> @CompileStatic{code}
> the error produced takes the form
> {code:java}
> Compiling with JDK Java compiler API.
> startup failed:
> .../kvdn/src/main/groovy/net/iowntheinter/kvdn/storage/kv/impl/KvOp.groovy:
> 123: Access to java.lang.Object#D is forbidden @ line 123, column 17.
> D.getMap(this.strAddr, { AsyncResult<AsyncMap> res ->
> {code}
> I believe the relevant code sections are:
>
> {code:java}
> @TypeChecked
> @CompileStatic
> class KvOp extends KvdnOperation implements KVOperation {
> public KVData D
> ...................
> @Override
> @TypeChecked
> void submit(..........) {
> .................
> startOperation(this.valueType, TXTYPE.KV_SUBMIT, key, content, {
> /*(ln123)*/ D.getMap(this.strAddr, { AsyncResult<AsyncMap> res ->
> .....................
> })
> })
> }
> {code}
>
>
>
--
This message was sent by Atlassian JIRA
(v7.6.14#76016)