Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
1.0-beta-3
-
None
-
None
Description
I added another test to the bug class below that attempts to update a static variable from with a closure in a static method. The result of the new test is this Error:
java.lang.NoSuchFieldError: owner
at UseStaticInClosureBug$2.doCall(C:\dev\cvsviews\groovy\groovy-core\target\test-classes\groovy\bugs\UseStaticInClosureBug.groovy)
class UseStaticInClosureBug extends GroovyTestCase {
static stuff = [:]
void testBug() {
[1,2,3].each
assert stuff.size() == 3
assert stuff[2] == "dog"
}
void testBug2() { doStatic() }
static doStatic() {
[1,2,3].each { stuff[it] = "dog" }
assert stuff.size() == 3
assert stuff[2] == "dog"
}
}