|
Groovy example source code file (UseStaticInClosureBug.groovy)
The Groovy UseStaticInClosureBug.groovy source code
package groovy.bugs
/**
* @version $Revision: 4996 $
*/
class UseStaticInClosureBug extends GroovyTestCase {
static def stuff = [:]
void testBug() {
[1,2,3].each { stuff[it] = "dog" }
assert stuff.size() == 3
assert stuff[2] == "dog"
}
void testBug2() {
doStatic()
}
static def doStatic() {
[1,2,3].each { stuff[it] = "dog" }
assert stuff.size() == 3
assert stuff[2] == "dog"
}
}
Other Groovy examples (source code examples)Here is a short list of links related to this Groovy UseStaticInClosureBug.groovy source code file: |
Other websites by Alvin Alexander:
Life/living in Alaska (OneMansAlaska.com)
How I Sold My Business (HowISoldMyBusiness.com)
Copyright 1998-2011 Alvin Alexander, devdaily.com
All Rights Reserved.