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

Paul King updated GROOVY-12450:
-------------------------------
    Description: 
This works:
{code:groovy}
def (result: r, duration: d) = System.timed {
    new Date()
}
println r
println d.toNanos()
{code}

But the shorter variant fails:
{code:groovy}
def (r, d) = System.timed {
    new Date()
}
println r
println d
{code}
with:
{noformat}
MissingMethodException: No signature of method: getAt for class: 
groovy.time.Timed is applicable for argument types: (Integer) values: [0]
{noformat}
We could make Timed a Groovy record instead of a Java record, or provide 
getAt(int) and any other methods we may want, e.g. toMap, etc.


  was:
This works:
{code:groovy}
def (result: r, duration: d) = System.timed {
    new Date()
}
println r
println d.toNanos()
{code}

But the shorter variant fails:
{code:groovy}
def (r, d) = System.timed {
    new Date()
}
println r
println d.toNanos()
{code}
with:
{noformat}
MissingMethodException: No signature of method: getAt for class: 
groovy.time.Timed is applicable for argument types: (Integer) values: [0]
{noformat}
We could make Timed a Groovy record instead of a Java record, or provide 
getAt(int) and any other methods we may want, e.g. toMap, etc.



> Provide a getAt(int) method for groovy.time.Timed
> -------------------------------------------------
>
>                 Key: GROOVY-12450
>                 URL: https://issues.apache.org/jira/browse/GROOVY-12450
>             Project: Groovy
>          Issue Type: Improvement
>            Reporter: Paul King
>            Assignee: Paul King
>            Priority: Major
>
> This works:
> {code:groovy}
> def (result: r, duration: d) = System.timed {
>     new Date()
> }
> println r
> println d.toNanos()
> {code}
> But the shorter variant fails:
> {code:groovy}
> def (r, d) = System.timed {
>     new Date()
> }
> println r
> println d
> {code}
> with:
> {noformat}
> MissingMethodException: No signature of method: getAt for class: 
> groovy.time.Timed is applicable for argument types: (Integer) values: [0]
> {noformat}
> We could make Timed a Groovy record instead of a Java record, or provide 
> getAt(int) and any other methods we may want, e.g. toMap, etc.



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

Reply via email to