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

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

codecov-commenter commented on PR #3200:
URL: https://github.com/apache/groovy/pull/3200#issuecomment-6612829754

   ## 
[Codecov](https://app.codecov.io/gh/apache/groovy/pull/3200?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
 Report
   :x: Patch coverage is `97.14286%` with `1 line` in your changes missing 
coverage. Please review.
   :white_check_mark: Project coverage is 74.1633%. Comparing base 
([`0941dba`](https://app.codecov.io/gh/apache/groovy/commit/0941dbacf496a1667c27681c6fe76deee59bfb57?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache))
 to head 
([`1f6ae82`](https://app.codecov.io/gh/apache/groovy/commit/1f6ae82b31a0f427b42ad8fb5f8da2f2ce4b3129?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
   :warning: Report is 11 commits behind head on master.
   
   | [Files with missing 
lines](https://app.codecov.io/gh/apache/groovy/pull/3200?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
 | Patch % | Lines |
   |---|---|---|
   | 
[...apache/groovy/runtime/async/AsyncClosureUtils.java](https://app.codecov.io/gh/apache/groovy/pull/3200?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fapache%2Fgroovy%2Fruntime%2Fasync%2FAsyncClosureUtils.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2dyb292eS9ydW50aW1lL2FzeW5jL0FzeW5jQ2xvc3VyZVV0aWxzLmphdmE=)
 | 97.1429% | [0 Missing and 1 partial :warning: 
](https://app.codecov.io/gh/apache/groovy/pull/3200?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
 |
   
   <details><summary>Additional details and impacted files</summary>
   
   
   
   [![Impacted file tree 
graph](https://app.codecov.io/gh/apache/groovy/pull/3200/graphs/tree.svg?width=650&height=150&src=pr&token=1r45138NfQ&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)](https://app.codecov.io/gh/apache/groovy/pull/3200?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
   
   ```diff
   @@                Coverage Diff                 @@
   ##               master      #3200        +/-   ##
   ==================================================
   + Coverage     74.1533%   74.1633%   +0.0100%     
   - Complexity      43751      43758         +7     
   ==================================================
     Files            1692       1692                
     Lines          149516     149547        +31     
     Branches        28366      28367         +1     
   ==================================================
   + Hits           110871     110909        +38     
   + Misses          28448      28441         -7     
     Partials        10197      10197                
   ```
   
   | [Files with missing 
lines](https://app.codecov.io/gh/apache/groovy/pull/3200?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
 | Coverage Δ | |
   |---|---|---|
   | 
[...apache/groovy/runtime/async/AsyncClosureUtils.java](https://app.codecov.io/gh/apache/groovy/pull/3200?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fapache%2Fgroovy%2Fruntime%2Fasync%2FAsyncClosureUtils.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2dyb292eS9ydW50aW1lL2FzeW5jL0FzeW5jQ2xvc3VyZVV0aWxzLmphdmE=)
 | `97.5610% <97.1429%> (-2.4390%)` | :arrow_down: |
   
   ... and [13 files with indirect coverage 
changes](https://app.codecov.io/gh/apache/groovy/pull/3200/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
   </details>
   <details><summary> :rocket: New features to boost your workflow: </summary>
   
   - :snowflake: [Test 
Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, 
report on failures, and find test suite problems.
   - :package: [JS Bundle 
Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save 
yourself from yourself by tracking and limiting bundle sizes in JS merges.
   </details>




> Closures from AsyncClosureUtils.wrapAsync/wrapAsyncGenerator ignore the 
> delegate and resolve strategy and misreport their parameters
> ------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: GROOVY-12679
>                 URL: https://issues.apache.org/jira/browse/GROOVY-12679
>             Project: Groovy
>          Issue Type: Bug
>    Affects Versions: 7.0.0-alpha-1, 6.0.0
>            Reporter: Scott Murphy Heiberg
>            Priority: Major
>
> {code:groovy}
> import org.apache.groovy.runtime.async.AsyncClosureUtils
> class Ctx { String greet() { 'hi' } }
> Closure wrapped = AsyncClosureUtils.wrapAsync { -> greet() }
> wrapped.delegate = new Ctx()
> wrapped.resolveStrategy = Closure.DELEGATE_FIRST
> assert await(wrapped()) == 'hi'
> assert await(new Ctx().with(AsyncClosureUtils.wrapAsync { greet() })) == 'hi'
> def w = AsyncClosureUtils.wrapAsync { String k, Integer v -> k * v }
> assert w.maximumNumberOfParameters == 2
> assert [a: 1, b: 2].collect(w).collect { await(it) } == ['a', 'bb']
> {code}
> *Actual:* MissingMethodException: No signature of method: greet for class: 
> Script1. After setting a delegate on the wrapper, getDelegate() still returns 
> the script and getResolveStrategy() returns OWNER_FIRST. If the wrapped 
> closure is configured instead, the wrapper reports its own owner and 
> OWNER_FIRST. The wrapper reports one Object[] parameter, so Map.collect 
> passes the entry to a two-parameter closure and fails with 
> MissingMethodException: doCall ... (Entry). wrapAsyncGenerator behaves the 
> same.
> *Expected:* the same behaviour as calling the wrapped closure directly: names 
> resolve against the delegate, with(), dehydrate() and rehydrate() work, and 
> the wrapped closure's parameters are reported.
> Cause: the wrappers are anonymous Closure subclasses that copy only the owner 
> and this object of the wrapped closure. They keep their own delegate and 
> resolve strategy, which the wrapped closure never sees, and report the 
> parameters of their own doCall(Object...).
> Verified on 6.0.0 and master (the API is new in 6.0.0).



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to