Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 1.8.0
-
Fix Version/s: 1.8.4, 2.0-beta-1
-
Component/s: Compiler
-
Labels:None
-
Number of attachments :
Description
The following works with 1.7.x but fails with 1.8.0
Demo.groovy
class Demo {
void doit() {
execute new Runnable(){
void run() {
println 'hello'
}
}
}
void execute(arg) {
arg.run()
}
static void main(args) {
new Demo().doit()
}
}
The code fails with a MissingPropertyException:
$ groovy Demo
Caught: groovy.lang.MissingPropertyException: No such property: execute for class: Demo
at Demo.doit(Demo.groovy:4)
at Demo.main(Demo.groovy:16)
If I put parens around the argument to the execute method, then it appears to work:
Demo.groovy
class Demo {
void doit() {
execute(new Runnable(){
void run() {
println 'hello'
}
})
}
void execute(arg) {
arg.run()
}
static void main(args) {
new Demo().doit()
}
}