[ 
https://issues.apache.org/jira/browse/GROOVY-9252?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Radoslav Ivanov updated GROOVY-9252:
------------------------------------
    Description: 
Please advise with that problematic code (note it is working on 2.4.15 
perfectly but not on 2.5.8):
{code:java}
public class MyClass {
  public boolean myField
}

MyClass myClass = new MyClass()
List list = new ArrayList()
list.each {
    myClass.myField = myClass.myField // BOOM!!!
}
{code}
 

Why I get an error that access to myField is forbidden:
{code:java}
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
-1: Access to java.lang.Object#myField is forbidden @ line -1, column -1.
1 error

"org.codehaus.groovy@2.5.8//org.codehaus.groovy.control.ErrorCollector.failIfErrors(ErrorCollector.java:311)
"org.codehaus.groovy@2.5.8//org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1091)
"org.codehaus.groovy@2.5.8//org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:634)
"org.codehaus.groovy@2.5.8//org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:612)
"org.codehaus.groovy@2.5.8//org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:589)
"org.codehaus.groovy@2.5.8//groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:401)
"org.codehaus.groovy@2.5.8//groovy.lang.GroovyClassLoader.access$300(GroovyClassLoader.java:89)
"org.codehaus.groovy@2.5.8//groovy.lang.GroovyClassLoader$5.provide(GroovyClassLoader.java:341)
"org.codehaus.groovy@2.5.8//groovy.lang.GroovyClassLoader$5.provide(GroovyClassLoader.java:338)
"org.codehaus.groovy@2.5.8//org.codehaus.groovy.runtime.memoize.ConcurrentCommonCache.getAndPut(ConcurrentCommonCache.java:147)
"org.codehaus.groovy@2.5.8//groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:336)
"org.codehaus.groovy@2.5.8//groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:320)
"org.codehaus.groovy@2.5.8//groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:262)
"org.codehaus.groovy@2.5.8//groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:272)
{code}
 

 

  was:
Please advise with that problematic code (note it is working on 2.4.15 
perfectly but not on 2.5.8):
{code:java}
public class MyClass {
  public boolean myField
}

MyClass myClass = new MyClass()
List list = new ArrayList()
list.each {
    myClass.myField = myClass.myField
}
{code}
 

Why I get an error that access to myField is forbidden:
{code:java}
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
-1: Access to java.lang.Object#myField is forbidden @ line -1, column -1.
1 error

"org.codehaus.groovy@2.5.8//org.codehaus.groovy.control.ErrorCollector.failIfErrors(ErrorCollector.java:311)
"org.codehaus.groovy@2.5.8//org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1091)
"org.codehaus.groovy@2.5.8//org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:634)
"org.codehaus.groovy@2.5.8//org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:612)
"org.codehaus.groovy@2.5.8//org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:589)
"org.codehaus.groovy@2.5.8//groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:401)
"org.codehaus.groovy@2.5.8//groovy.lang.GroovyClassLoader.access$300(GroovyClassLoader.java:89)
"org.codehaus.groovy@2.5.8//groovy.lang.GroovyClassLoader$5.provide(GroovyClassLoader.java:341)
"org.codehaus.groovy@2.5.8//groovy.lang.GroovyClassLoader$5.provide(GroovyClassLoader.java:338)
"org.codehaus.groovy@2.5.8//org.codehaus.groovy.runtime.memoize.ConcurrentCommonCache.getAndPut(ConcurrentCommonCache.java:147)
"org.codehaus.groovy@2.5.8//groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:336)
"org.codehaus.groovy@2.5.8//groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:320)
"org.codehaus.groovy@2.5.8//groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:262)
"org.codehaus.groovy@2.5.8//groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:272)
{code}
 

 


> -1: Access to java.lang.Object#myField is forbidden @ line -1, column -1.
> -------------------------------------------------------------------------
>
>                 Key: GROOVY-9252
>                 URL: https://issues.apache.org/jira/browse/GROOVY-9252
>             Project: Groovy
>          Issue Type: Bug
>    Affects Versions: 2.5.8
>            Reporter: Radoslav Ivanov
>            Priority: Critical
>
> Please advise with that problematic code (note it is working on 2.4.15 
> perfectly but not on 2.5.8):
> {code:java}
> public class MyClass {
>   public boolean myField
> }
> MyClass myClass = new MyClass()
> List list = new ArrayList()
> list.each {
>     myClass.myField = myClass.myField // BOOM!!!
> }
> {code}
>  
> Why I get an error that access to myField is forbidden:
> {code:java}
> org.codehaus.groovy.control.MultipleCompilationErrorsException: startup 
> failed:
> -1: Access to java.lang.Object#myField is forbidden @ line -1, column -1.
> 1 error
> "org.codehaus.groovy@2.5.8//org.codehaus.groovy.control.ErrorCollector.failIfErrors(ErrorCollector.java:311)
> "org.codehaus.groovy@2.5.8//org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1091)
> "org.codehaus.groovy@2.5.8//org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:634)
> "org.codehaus.groovy@2.5.8//org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:612)
> "org.codehaus.groovy@2.5.8//org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:589)
> "org.codehaus.groovy@2.5.8//groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:401)
> "org.codehaus.groovy@2.5.8//groovy.lang.GroovyClassLoader.access$300(GroovyClassLoader.java:89)
> "org.codehaus.groovy@2.5.8//groovy.lang.GroovyClassLoader$5.provide(GroovyClassLoader.java:341)
> "org.codehaus.groovy@2.5.8//groovy.lang.GroovyClassLoader$5.provide(GroovyClassLoader.java:338)
> "org.codehaus.groovy@2.5.8//org.codehaus.groovy.runtime.memoize.ConcurrentCommonCache.getAndPut(ConcurrentCommonCache.java:147)
> "org.codehaus.groovy@2.5.8//groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:336)
> "org.codehaus.groovy@2.5.8//groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:320)
> "org.codehaus.groovy@2.5.8//groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:262)
> "org.codehaus.groovy@2.5.8//groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:272)
> {code}
>  
>  



--
This message was sent by Atlassian Jira
(v8.3.2#803003)

Reply via email to