You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Damir Murat (Jira)" <ji...@apache.org> on 2020/12/21 08:31:00 UTC

[jira] [Commented] (GROOVY-9858) In generated closures, annotate generated call() methods with @Generated

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

Damir Murat commented on GROOVY-9858:
-------------------------------------

PR: https://github.com/apache/groovy/pull/1448

> In generated closures, annotate generated call() methods with @Generated
> ------------------------------------------------------------------------
>
>                 Key: GROOVY-9858
>                 URL: https://issues.apache.org/jira/browse/GROOVY-9858
>             Project: Groovy
>          Issue Type: Improvement
>          Components: Compiler
>    Affects Versions: 3.0.7
>            Reporter: Damir Murat
>            Priority: Minor
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> Closures generated by the Groovy compiler contain both "doCall()" and "call()" methods, where "call()" always delegate to the "doCall()".
> Typically, users will use a short form of closure invocation, which Groovy translates to direct call of "doCall()". This means that the generated "call()" method will never get invoked in a typical scenario.
> When using JaCoCo for code coverage, it will report the "call()" method as unused.
> For these reasons, it looks sensible to annotate all generated "call()" methods with "@Generated". That way "call()" method will appear in the coverage report, while the "doCall()", which contains the implementation of a closure body, will be reported as covered.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)