groovy-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Paul King (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (GROOVY-8827) Close a small gap in the EMC DSL for constructors
Date Mon, 08 Oct 2018 10:30:00 GMT

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

Paul King updated GROOVY-8827:
------------------------------
    Fix Version/s:     (was: 2.5.4)
                   2.5.3

> Close a small gap in the EMC DSL for constructors
> -------------------------------------------------
>
>                 Key: GROOVY-8827
>                 URL: https://issues.apache.org/jira/browse/GROOVY-8827
>             Project: Groovy
>          Issue Type: Improvement
>    Affects Versions: 2.5.3
>            Reporter: Paul King
>            Assignee: Paul King
>            Priority: Major
>             Fix For: 3.0.0-alpha-4, 2.5.3
>
>
> In the sample below, the first short-hand (Integer case) is recognised, the second two
aren't for constructors even though they are for methods and work if "<init>" is used
instead:
> {code}
> Integer.metaClass {
>     constructor = { List l -> l.size() }
> }
> Short.metaClass {
>     constructor { List l -> l.size() as short }
> }
> Long.metaClass {
>     constructor << { List l -> l.size() as long }
> }
> def result = [[] as Short, ['foo'] as Integer, ['bar', 'baz'] as Long]
> assert result.toString() == '[0, 1, 2]'
> assert result*.class == [Short, Integer, Long]
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message