ajwang / groovypptest

Automatically exported from code.google.com/p/groovypptest
0 stars 0 forks source link

Cannot modify a variable outside of closure #333

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
@Typed package hoge
int i = 0
[1].each {
  i++
}

This code creates the following error at groovypp 0.4.113 with both Groovy 
1.7.6 or 1.7.5. 

org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
C:\temp\Test.groovy: 4: Cannot modify final field hoge.Test$run$1.i
 @ line 4, column 3.
     i++
     ^

Original issue reported on code.google.com by yukoba on 1 Jan 2011 at 4:53

GoogleCodeExporter commented 8 years ago
This is not bug but feature.

Original comment by alex.tka...@gmail.com on 1 Jan 2011 at 6:27

GoogleCodeExporter commented 8 years ago
I could not find the limitation list in Wiki.
Could you please write that?

Original comment by yukoba on 1 Jan 2011 at 8:26

GoogleCodeExporter commented 8 years ago
http://code.google.com/p/groovypptest/wiki/DiffWithStandard

Original comment by alex.tka...@gmail.com on 1 Jan 2011 at 8:35