6
* Accessible to a closure attribute of an abject with the operator ".@".
7
* For examples, all of the expressions
10
* object.@closure.call()
11
* object.@closure.doCall()
14
* have the same meaning.
20
class Groovy1059_Bug extends GroovyTestCase {
22
void testClosureAsAttribute() {
23
def x = new Groovy1059Foo()
27
println( x.@say() ) // TODO: Groovy-1059 should work
28
println( x.@say.call() )
29
println( x.@say.doCall() )
32
assert "I am a Method" == x.say()
33
assert "I am a Method" == x.@say2()
34
assert "I am a Closure" == (x.@say)()
35
assert "I am a Closure" == x.@say()
36
assert x.@say() == (x.@say)()
37
assert x.@say() == x.@say.call()
38
assert x.@say() == x.@say.doCall()
39
assert x.@say() != x.say()
40
assert x.@say2() == x.say()
47
def public say = { it -> return "I am a Closure" }
48
def public say2 = this.&say
51
return "I am a Method"
6
* Accessible to a closure attribute of an abject with the operator ".@".
7
* For examples, all of the expressions
10
* object.@closure.call()
11
* object.@closure.doCall()
14
* have the same meaning.
20
class Groovy1059_Bug extends GroovyTestCase {
22
void testClosureAsAttribute() {
23
def x = new Groovy1059Foo()
27
println( x.@say() ) // TODO: Groovy-1059 should work
28
println( x.@say.call() )
29
println( x.@say.doCall() )
32
assert "I am a Method" == x.say()
33
assert "I am a Method" == x.@say2()
34
assert "I am a Closure" == (x.@say)()
35
assert "I am a Closure" == x.@say()
36
assert x.@say() == (x.@say)()
37
assert x.@say() == x.@say.call()
38
assert x.@say() == x.@say.doCall()
39
assert x.@say() != x.say()
40
assert x.@say2() == x.say()
47
def public say = { it -> return "I am a Closure" }
48
def public say2 = this.&say
51
return "I am a Method"