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

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

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

   ## 
[Codecov](https://app.codecov.io/gh/apache/groovy/pull/3182?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 `75.00000%` with `2 lines` in your changes missing 
coverage. Please review.
   :white_check_mark: Project coverage is 74.1592%. 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 
([`9c5686b`](https://app.codecov.io/gh/apache/groovy/commit/9c5686bd562195b6a83c17f4a83b0778ed55ae99?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/3182?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
 | Patch % | Lines |
   |---|---|---|
   | 
[...ava/org/codehaus/groovy/runtime/PackedClosure.java](https://app.codecov.io/gh/apache/groovy/pull/3182?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fcodehaus%2Fgroovy%2Fruntime%2FPackedClosure.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvY29kZWhhdXMvZ3Jvb3Z5L3J1bnRpbWUvUGFja2VkQ2xvc3VyZS5qYXZh)
 | 75.0000% | [1 Missing and 1 partial :warning: 
](https://app.codecov.io/gh/apache/groovy/pull/3182?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/3182/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/3182?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
   
   ```diff
   @@                Coverage Diff                 @@
   ##               master      #3182        +/-   ##
   ==================================================
   + Coverage     74.1533%   74.1592%   +0.0059%     
   - Complexity      43751      43764        +13     
   ==================================================
     Files            1692       1692                
     Lines          149516     149523         +7     
     Branches        28366      28368         +2     
   ==================================================
   + Hits           110871     110885        +14     
   + Misses          28448      28444         -4     
   + Partials        10197      10194         -3     
   ```
   
   | [Files with missing 
lines](https://app.codecov.io/gh/apache/groovy/pull/3182?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/transform/PackedClosures.java](https://app.codecov.io/gh/apache/groovy/pull/3182?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Fgroovy%2Ftransform%2FPackedClosures.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9ncm9vdnkvdHJhbnNmb3JtL1BhY2tlZENsb3N1cmVzLmphdmE=)
 | `100.0000% <ø> (ø)` | |
   | 
[...ava/org/codehaus/groovy/runtime/PackedClosure.java](https://app.codecov.io/gh/apache/groovy/pull/3182?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fcodehaus%2Fgroovy%2Fruntime%2FPackedClosure.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvY29kZWhhdXMvZ3Jvb3Z5L3J1bnRpbWUvUGFja2VkQ2xvc3VyZS5qYXZh)
 | `57.7640% <75.0000%> (+1.2705%)` | :arrow_up: |
   
   ... and [10 files with indirect coverage 
changes](https://app.codecov.io/gh/apache/groovy/pull/3182/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>




> A @PackedClosures closure silently ignores the delegate, owner and thisObject 
> passed to rehydrate instead of failing fast like setDelegate
> ------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: GROOVY-12661
>                 URL: https://issues.apache.org/jira/browse/GROOVY-12661
>             Project: Groovy
>          Issue Type: Bug
>    Affects Versions: 7.0.0-alpha-1, 6.0.0
>            Reporter: Scott Murphy Heiberg
>            Priority: Major
>
> With {{@PackedClosures}} under dynamic compilation, 
> {{PackedClosure.setDelegate}} refuses a delegate other than the owner, 
> because the hoisted body binds its free names to the owner at compile time. 
> {{Closure.rehydrate}} writes the delegate, owner and thisObject fields on the 
> copy directly, so it bypasses that guard. The packed body keeps calling the 
> original owner, and the new delegate or owner is silently ignored.
> {code:groovy}
> class D { String foo() { 'delegate' } }
> @groovy.transform.PackedClosures
> class O {
>     String foo() { 'owner' }
>     def m(D d) {
>         def c = { -> foo() }
>         println c.rehydrate(d, d, d)()
>         println c.rehydrate(d, this, this).delegate == d
>         c.delegate = d
>     }
> }
> new O().m(new D())
> {code}
> *Actual:* prints {{owner}} and {{true}}, then the last line throws 
> UnsupportedOperationException ("Cannot set a delegate on a @PackedClosures 
> closure ..."). Rehydrating onto another owner of the same class also returns 
> the original owner's result.
> *Expected:* rehydrate refuses a delegate, owner or this object the packed 
> body cannot honour, with the same UnsupportedOperationException as 
> setDelegate. Without the annotation the closure prints {{delegate}}.
> Cause: PackedClosure guards setDelegate and setResolveStrategy but not 
> rehydrate, which sets the fields without calling setDelegate.
> Verified on 6.0.0 and master.



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

Reply via email to