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

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

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

   ## 
[Codecov](https://app.codecov.io/gh/apache/groovy/pull/3104?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 73.6776%. Comparing base 
([`5b077f9`](https://app.codecov.io/gh/apache/groovy/commit/5b077f9dcf610898e3415f1f1cebbaab8eecab61?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache))
 to head 
([`7d3ef9a`](https://app.codecov.io/gh/apache/groovy/commit/7d3ef9aa06d8da482464464bc6767974e6fed774?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
   :warning: Report is 4 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/3104/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/3104?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
   
   ```diff
   @@                Coverage Diff                 @@
   ##               master      #3104        +/-   ##
   ==================================================
   + Coverage     73.6711%   73.6776%   +0.0065%     
   - Complexity      42584      42592         +8     
   ==================================================
     Files            1678       1678                
     Lines          146907     146913         +6     
     Branches        27790      27792         +2     
   ==================================================
   + Hits           108228     108242        +14     
   + Misses          28528      28524         -4     
   + Partials        10151      10147         -4     
   ```
   
   | [Files with missing 
lines](https://app.codecov.io/gh/apache/groovy/pull/3104?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
 | Coverage Δ | |
   |---|---|---|
   | 
[...aus/groovy/runtime/metaclass/ClosureMetaClass.java](https://app.codecov.io/gh/apache/groovy/pull/3104?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fcodehaus%2Fgroovy%2Fruntime%2Fmetaclass%2FClosureMetaClass.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvY29kZWhhdXMvZ3Jvb3Z5L3J1bnRpbWUvbWV0YWNsYXNzL0Nsb3N1cmVNZXRhQ2xhc3MuamF2YQ==)
 | `71.9858% <100.0000%> (+0.3546%)` | :arrow_up: |
   
   ... and [13 files with indirect coverage 
changes](https://app.codecov.io/gh/apache/groovy/pull/3104/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 closure's own method runs twice when neither the delegate nor the owner can 
> take the call
> -------------------------------------------------------------------------------------------
>
>                 Key: GROOVY-12578
>                 URL: https://issues.apache.org/jira/browse/GROOVY-12578
>             Project: Groovy
>          Issue Type: Bug
>          Components: groovy-runtime
>    Affects Versions: 6.0.0
>            Reporter: Scott Murphy Heiberg
>            Priority: Major
>
> For an implicit-this call in a closure body to a method the closure inherits, 
> such as {{toString()}} or a default Groovy method like {{with}}, {{tap}} or 
> {{identity}}, {{ClosureMetaClass}} tries the delegate and the owner first and 
> keeps the closure's own method as the fallback. When neither can take the 
> call, it invokes the fallback, discards the result and throws 
> {{MissingMethodException}}; invokedynamic catches it and calls the method 
> again through {{GroovyObject.invokeMethod}}, so the method runs twice:
> {code:groovy}
> class C { Closure<Integer> withCount() { { -> int n = 0; with { n++ }; n } } }
> Closure<Integer> c = new C().withCount().rehydrate(null, null, null)
> c.resolveStrategy = Closure.OWNER_ONLY
> assert c() == 1 // 2
> {code}
> Called through the meta class directly ({{c.metaClass.invokeMethod(...)}}), 
> the call throws {{MissingMethodException}} after running the method. A 
> closure without an owner and with {{OWNER_ONLY}}, or with {{DELEGATE_ONLY}} 
> and no delegate, reaches the fallback. Expected: the fallback's result is 
> returned.
> PR: https://github.com/apache/groovy/pull/3104



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

Reply via email to