[ 
https://issues.apache.org/jira/browse/GROOVY-12450?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18126673#comment-18126673
 ] 

ASF GitHub Bot commented on GROOVY-12450:
-----------------------------------------

paulk-asert opened a new pull request, #2979:
URL: https://github.com/apache/groovy/pull/2979

   …t, toMap, toList, size) for groovy.time.Timed




> Provide some of Groovy's enhanced record features (getAt, toMap, toList, 
> size) 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