Details
-
Type:
Bug
-
Status:
Open
-
Priority:
Major
-
Resolution: Unresolved
-
Affects Version/s: 1.7.8
-
Fix Version/s: None
-
Component/s: None
-
Labels:None
-
Number of attachments :
Description
Some code that was working in 1.7.5 (Grails pre-1.3.7) is failing now that we've upgraded to 1.7.8 for 1.3.7. Here's a simplified version:
class Base {
private String x = 'x'
void theMethod() {
println "outside closure, x == $x"
callWithClosure { ->
println "inside closure, x == $x"
}
}
void callWithClosure(Closure c) { c() }
}
Running
new Base().theMethod()
prints the expected
outside closure, x == x inside closure, x == x
but if I call it on a subclass:
class Super extends Base {}
it fails:
new Super().theMethod()
outside closure, x == x
Exception thrown
groovy.lang.MissingPropertyException: No such property: x for class: Super
at Base$_theMethod_closure1.doCall(Base.groovy:9)
at Base.callWithClosure(Base.groovy:13)
at Base$callWithClosure.callCurrent(Unknown Source)
at Base$callWithClosure.callCurrent(Unknown Source)
at Base.theMethod(Base.groovy:8)
at Base$theMethod.call(Unknown Source)
at ConsoleScript1.run(ConsoleScript1:1)
I cannot confirm that there is any Groovy version in which this would have been working. The 1.7.5 for example fails. It seems your simplified version is too simplified to reproduce the issue