You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "XiaoboMo (JIRA)" <ji...@apache.org> on 2017/07/21 07:50:00 UTC

[jira] [Updated] (GROOVY-8266) Closure to arbitrary type coercion. Call one method, but another is executed also.

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

XiaoboMo updated GROOVY-8266:
-----------------------------
       Priority: Trivial  (was: Major)
    Description: sorry about my mis-understanding  (was: I have a xxx.groovy script file.

{code:java}
interface FooBar {
    int foo()

    void bar()
}

// ALL OK
// def impl =  [bar:{println 'ok'}, foo:{ 123 }] as FooBar

// `ok` is printed, which I think a bug.
def impl = { println 'ok'; 123 } as FooBar

assert impl.foo() == 123
{code}

Then I use 'groovy xxx.groovy' command to run the script. I get `ok` shown on my console.

I get the code from [http://www.groovy-lang.org/semantics.html#_closure_to_arbitrary_type_coercion])
     Issue Type: Temp  (was: Bug)

> Closure to arbitrary type coercion. Call one method, but another is executed also.
> ----------------------------------------------------------------------------------
>
>                 Key: GROOVY-8266
>                 URL: https://issues.apache.org/jira/browse/GROOVY-8266
>             Project: Groovy
>          Issue Type: Temp
>    Affects Versions: 2.4.12
>            Reporter: XiaoboMo
>            Priority: Trivial
>
> sorry about my mis-understanding



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)