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

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

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

   ## 
[Codecov](https://app.codecov.io/gh/apache/groovy/pull/3194?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
 Report
   :white_check_mark: All modified and coverable lines are covered by tests.
   :white_check_mark: Project coverage is 74.1572%. 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 
([`bd588fd`](https://app.codecov.io/gh/apache/groovy/commit/bd588fdecc3b2eb2f66f2c64b2afb34b8f1122c3?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.
   
   <details><summary>Additional details and impacted files</summary>
   
   
   
   [![Impacted file tree 
graph](https://app.codecov.io/gh/apache/groovy/pull/3194/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/3194?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
   
   ```diff
   @@                Coverage Diff                 @@
   ##               master      #3194        +/-   ##
   ==================================================
   + Coverage     74.1533%   74.1572%   +0.0039%     
   - Complexity      43751      43759         +8     
   ==================================================
     Files            1692       1692                
     Lines          149516     149535        +19     
     Branches        28366      28366                
   ==================================================
   + Hits           110871     110891        +20     
   + Misses          28448      28446         -2     
   - Partials        10197      10198         +1     
   ```
   
   | [Files with missing 
lines](https://app.codecov.io/gh/apache/groovy/pull/3194?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
 | Coverage Δ | |
   |---|---|---|
   | 
[src/main/java/groovy/lang/Closure.java](https://app.codecov.io/gh/apache/groovy/pull/3194?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Fgroovy%2Flang%2FClosure.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9ncm9vdnkvbGFuZy9DbG9zdXJlLmphdmE=)
 | `85.2174% <100.0000%> (+0.2501%)` | :arrow_up: |
   | 
[src/main/java/groovy/lang/TrampolineClosure.java](https://app.codecov.io/gh/apache/groovy/pull/3194?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Fgroovy%2Flang%2FTrampolineClosure.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9ncm9vdnkvbGFuZy9UcmFtcG9saW5lQ2xvc3VyZS5qYXZh)
 | `95.8333% <100.0000%> (+13.4804%)` | :arrow_up: |
   | 
[...a/org/codehaus/groovy/runtime/ComposedClosure.java](https://app.codecov.io/gh/apache/groovy/pull/3194?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fcodehaus%2Fgroovy%2Fruntime%2FComposedClosure.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvY29kZWhhdXMvZ3Jvb3Z5L3J1bnRpbWUvQ29tcG9zZWRDbG9zdXJlLmphdmE=)
 | `82.6087% <100.0000%> (+5.3360%)` | :arrow_up: |
   | 
[...va/org/codehaus/groovy/runtime/CurriedClosure.java](https://app.codecov.io/gh/apache/groovy/pull/3194?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fcodehaus%2Fgroovy%2Fruntime%2FCurriedClosure.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvY29kZWhhdXMvZ3Jvb3Z5L3J1bnRpbWUvQ3VycmllZENsb3N1cmUuamF2YQ==)
 | `91.3044% <100.0000%> (+0.0956%)` | :arrow_up: |
   | 
[...a/org/codehaus/groovy/runtime/memoize/Memoize.java](https://app.codecov.io/gh/apache/groovy/pull/3194?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fcodehaus%2Fgroovy%2Fruntime%2Fmemoize%2FMemoize.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvY29kZWhhdXMvZ3Jvb3Z5L3J1bnRpbWUvbWVtb2l6ZS9NZW1vaXplLmphdmE=)
 | `81.8182% <100.0000%> (+3.5573%)` | :arrow_up: |
   
   ... and [14 files with indirect coverage 
changes](https://app.codecov.io/gh/apache/groovy/pull/3194/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>




> Closure wrappers (trampoline, memoize, curry, compose, asWritable) report the 
> wrong delegate or thisObject and ignore delegate and resolveStrategy changes
> ----------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: GROOVY-12673
>                 URL: https://issues.apache.org/jira/browse/GROOVY-12673
>             Project: Groovy
>          Issue Type: Bug
>    Affects Versions: 4.0.33, 5.0.8, 7.0.0-alpha-1, 6.0.0
>            Reporter: Scott Murphy Heiberg
>            Priority: Major
>
> {code:groovy}
> class D { def m() { 'delegate' } }
> class O {
>     def m() { 'owner' }
>     def run() {
>         def c = { x -> m() }
>         assert c.curry(1).thisObject.is(this)        // fails: null (also for 
> c >> {...}, and c.asWritable().getThisObject())
>         def t = c.trampoline()
>         assert t.thisObject.is(this)                 // fails: the delegate 
> of c
>         t.resolveStrategy = Closure.DELEGATE_FIRST
>         t.delegate = new D()
>         assert t(1) == 'delegate'                    // fails: 'owner'
>         def m = { x -> m() }.memoize()
>         m.resolveStrategy = Closure.DELEGATE_FIRST
>         m.delegate = new D()
>         assert m(1) == 'delegate'                    // fails: 'owner'
>     }
> }
> new O().run()
> {code}
> *Actual:* curried and composed closures report a null thisObject. A writable 
> closure's getThisObject() returns null, so the property read under 
> @CompileStatic gives null too. A trampolined closure reports the wrapped 
> closure's delegate as its thisObject and its owner as its delegate. A 
> memoized closure reports the owner as its delegate and null as its 
> thisObject. Setting delegate or resolveStrategy on a trampolined or memoized 
> closure has no effect on the call. {{c.asWritable().trampoline()}} also 
> reports one Object[] parameter instead of the parameters of c.
> *Expected:* a wrapper reports the delegate, resolve strategy and thisObject 
> of the closure it wraps, and setting delegate or resolveStrategy on it 
> applies to that closure, as ComposedClosure and CurriedClosure already do for 
> delegate and resolveStrategy.
> Cause: TrampolineClosure passes original.getDelegate() as thisObject, and 
> neither TrampolineClosure nor Memoize.MemoizeFunction forwards the delegate 
> and resolve strategy. CurriedClosure, ComposedClosure and WritableClosure do 
> not forward getThisObject. TrampolineClosure reads the wrapped closure's 
> parameter fields instead of its getters.
> Verified on 4.0.33, 5.0.8, 6.0.0 and master.



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

Reply via email to