|
Groovy example source code file (ClosureParameterPassingBug.groovy)
The Groovy ClosureParameterPassingBug.groovy source codepackage groovy.bugs import org.codehaus.groovy.classgen.TestSupport /** * @author John Wilson * @version $Revision: 4996 $ */ class ClosureParameterPassingBug extends TestSupport { void testBugInMethod() { def c = { x -> def y = 123 def c1 = { println y println x println x[0] } c1() } c([1]) } void testBug() { assertScript """ def c = { x -> def y = 123 def c1 = { assert x != null , "Could not find a value for x" assert y == 123 , "Could not find a value for y" println x[0] } c1() } c([1]) """ } } Other Groovy examples (source code examples)Here is a short list of links related to this Groovy ClosureParameterPassingBug.groovy source code file: |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.