[ 
https://issues.apache.org/jira/browse/GROOVY-8214?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Eric Milles reassigned GROOVY-8214:
-----------------------------------

    Assignee: Eric Milles

> Implicit .call is inconsistent
> ------------------------------
>
>                 Key: GROOVY-8214
>                 URL: https://issues.apache.org/jira/browse/GROOVY-8214
>             Project: Groovy
>          Issue Type: Bug
>            Reporter: Daniil Ovchinnikov
>            Assignee: Eric Milles
>            Priority: Major
>
> {code}
> interface Callable {
>   def call()
> }
> def callable = new Callable() {
>   def call() { println "callable local var" }
> }
> callable.call()
> callable()
> class ClassWithCallableField {
>   public ppp = new Callable() {
>     def call() { println "callable field" }
>   }
> }
> def cwcp = new ClassWithCallableField()
> cwcp.ppp.call()
> cwcp.ppp() // MME
> def foo(Callable p) {
>   p.call()
>   p()
> }
> foo new Callable() {
>   def call() { println "callable parameter" }
> }
> class ClassWithCallableGetter {
>   def getGetter() {
>     new Callable() {
>       def call() { println "callable getter" }
>     }
>   }
> }
> def cwcg = new ClassWithCallableGetter()
> cwcg.getter.call()
> cwcg.getter() // MME
> class ClassWithCallableFieldInside {
>   public bbb = new Callable() {
>     def call() { println "callable field inside class" }
>   }
>   def foo() {
>     bbb.call()
>     bbb()
>   }
> }
> new ClassWithCallableFieldInside().foo()
> class ClassWithCallableGetterInside {
>   def getGetter() {
>     new Callable() {
>       def call() { println "callable getter inside class" }
>     }
>   }
>   def foo() {
>     getter.call()
>     getter() // MME
>   }
> }
> new ClassWithCallableGetterInside().foo()
> {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to