Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 1.0-JSR-5
-
Fix Version/s: 1.0-JSR-6
-
Component/s: None
-
Labels:None
-
Environment:XP Pro SP2
Java 5
-
Number of attachments :
Description
I have a closure that constructs a node of a DOMBuilder tree. I am passing a parameter into this closure. This parameter becomes wrapped by nested groovy.lang.Reference objects with respect to the depth of the DOMBuilder node tree.
Example code (abridged):
def getNode = { parent, int i ->
def j = i
println("getNode: i = ${i}")
println("getNode: (j = ${j})")
parent.childOne() {
println("childOne: i = ${i}")
println("childOne: (j = ${j})")
childTwo() {
println("childTwo: i = ${i}")
println("childTwo: i.get() = ${i.get()}")
println("childTwo: (j = ${j})")
childThree() {
println("childThree: i = ${i}")
println("childThree: i.get() = ${i.get()}")
println("childThree: i.get().get() = ${i.get().get()}")
println("childThree: (j = ${j})")
}
}
}
}
def root = DOMBuilder.newInstance().rootElement() {
getNode(this, 1)
}
This produces the output:
getNode: i = 1
getNode: (j = 1)
childOne: i = 1
childOne: (j = 1)
childTwo: i = groovy.lang.Reference@14b5f4a
childTwo: i.get() = 1
childTwo: (j = 1)
childThree: i = groovy.lang.Reference@979e8b
childThree: i.get() = groovy.lang.Reference@14b5f4a
childThree: i.get().get() = 1
childThree: (j = 1)
Full source code is attached.
this was a issue in jsr-05 but is fixed in jsr-06