ajwang / groovypptest

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

Groovy:Cannot modify final field demo6.TestExpr$main$1.x #383

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
the following simple code reproduce the compile error:
@Typed
class TestExpr {

    public static void main(String[] args) {

        long x = 10;

        Closure c = { ->
            x = 100;
        }

        c.call()
        println x;  
    }
}
error on the line: x=100; Cannot modify final field demo6.TestExpr$main$1.x

What is the expected output? What do you see instead?

What version of the product are you using? On what operating system?
groovypp-0.4.250_1.7.10

Please provide any additional information below.

Original issue reported on code.google.com by wangzaix...@gmail.com on 7 Jun 2011 at 3:05

GoogleCodeExporter commented 8 years ago
This is by design. 

See 
http://groups.google.com/group/groovyplusplus/browse_thread/thread/d41af6e721b9b
ace

Original comment by roshanda...@gmail.com on 8 Jun 2011 at 4:53

GoogleCodeExporter commented 8 years ago
I think it is important that Groovypp is Groovy Plus Plus, which means it just 
add functions to groovy not break it.

If Groovypp is not compatible with groovy, it will makes it an obsolete branch.

The example code works well in groovy.

Original comment by wangzaix...@gmail.com on 9 Jun 2011 at 2:36