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

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

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

   ## 
[Codecov](https://app.codecov.io/gh/apache/groovy/pull/3365?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 `40.00000%` with `3 lines` in your changes missing 
coverage. Please review.
   :white_check_mark: Project coverage is 72.7222%. Comparing base 
([`76c7e55`](https://app.codecov.io/gh/apache/groovy/commit/76c7e55c9a33d161ba6bbdcf8c1eeb64097c3b12?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache))
 to head 
([`6bcf0cf`](https://app.codecov.io/gh/apache/groovy/commit/6bcf0cfe3d84c2ab0e341f85cac6683f2ef8c7bc?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
   :warning: Report is 1 commits behind head on GROOVY_6_0_X.
   
   | [Files with missing 
lines](https://app.codecov.io/gh/apache/groovy/pull/3365?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
 | Patch % | Lines |
   |---|---|---|
   | 
[...aus/groovy/runtime/metaclass/ClosureMetaClass.java](https://app.codecov.io/gh/apache/groovy/pull/3365?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==)
 | 33.3333% | [0 Missing and 2 partials :warning: 
](https://app.codecov.io/gh/apache/groovy/pull/3365?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
 |
   | 
[...roovy/transform/stc/StaticTypeCheckingVisitor.java](https://app.codecov.io/gh/apache/groovy/pull/3365?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fcodehaus%2Fgroovy%2Ftransform%2Fstc%2FStaticTypeCheckingVisitor.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvY29kZWhhdXMvZ3Jvb3Z5L3RyYW5zZm9ybS9zdGMvU3RhdGljVHlwZUNoZWNraW5nVmlzaXRvci5qYXZh)
 | 50.0000% | [0 Missing and 1 partial :warning: 
](https://app.codecov.io/gh/apache/groovy/pull/3365?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/3365/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/3365?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
   
   ```diff
   @@                  Coverage Diff                   @@
   ##             GROOVY_6_0_X      #3365        +/-   ##
   ======================================================
   - Coverage         72.7272%   72.7222%   -0.0050%     
   + Complexity          40373      40367         -6     
   ======================================================
     Files                1595       1595                
     Lines              141962     141958         -4     
     Branches            26926      26925         -1     
   ======================================================
   - Hits               103245     103235        -10     
   - Misses              29443      29447         +4     
   - Partials             9274       9276         +2     
   ```
   
   | [Files with missing 
lines](https://app.codecov.io/gh/apache/groovy/pull/3365?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
 | Coverage Δ | |
   |---|---|---|
   | 
[...rg/codehaus/groovy/classgen/asm/ClosureWriter.java](https://app.codecov.io/gh/apache/groovy/pull/3365?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fcodehaus%2Fgroovy%2Fclassgen%2Fasm%2FClosureWriter.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvY29kZWhhdXMvZ3Jvb3Z5L2NsYXNzZ2VuL2FzbS9DbG9zdXJlV3JpdGVyLmphdmE=)
 | `90.8343% <ø> (ø)` | |
   | 
[...oovy/classgen/asm/sc/StaticTypesClosureWriter.java](https://app.codecov.io/gh/apache/groovy/pull/3365?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fcodehaus%2Fgroovy%2Fclassgen%2Fasm%2Fsc%2FStaticTypesClosureWriter.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvY29kZWhhdXMvZ3Jvb3Z5L2NsYXNzZ2VuL2FzbS9zYy9TdGF0aWNUeXBlc0Nsb3N1cmVXcml0ZXIuamF2YQ==)
 | `68.7500% <ø> (-1.2500%)` | :arrow_down: |
   | 
[...roovy/transform/stc/StaticTypeCheckingVisitor.java](https://app.codecov.io/gh/apache/groovy/pull/3365?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fcodehaus%2Fgroovy%2Ftransform%2Fstc%2FStaticTypeCheckingVisitor.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvY29kZWhhdXMvZ3Jvb3Z5L3RyYW5zZm9ybS9zdGMvU3RhdGljVHlwZUNoZWNraW5nVmlzaXRvci5qYXZh)
 | `87.1254% <50.0000%> (-0.0392%)` | :arrow_down: |
   | 
[...aus/groovy/runtime/metaclass/ClosureMetaClass.java](https://app.codecov.io/gh/apache/groovy/pull/3365?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==)
 | `73.9003% <33.3333%> (-0.3601%)` | :arrow_down: |
   
   ... and [12 files with indirect coverage 
changes](https://app.codecov.io/gh/apache/groovy/pull/3365/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>




> An implicit call of a method of Object in a nested closure is answered by the 
> enclosing closure instead of being passed on to its owner or delegate
> ---------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: GROOVY-12829
>                 URL: https://issues.apache.org/jira/browse/GROOVY-12829
>             Project: Groovy
>          Issue Type: Bug
>            Reporter: Paul King
>            Assignee: Paul King
>            Priority: Major
>             Fix For: 7.0.0-alpha-1, 6.0.1
>
>
> h3. Description
> GROOVY-11858 (6.0.0) and GROOVY-12576 made an implicit call of 
> {{toString()}}, {{hashCode()}}, {{equals()}}, {{getClass()}} or an {{Object}} 
> extension method in a closure go to the closure's delegate or owner, instead 
> of the closure itself.
> That holds only for the closure whose body makes the call. When the owner is 
> itself a closure, the owner answers the call as an ordinary object and does 
> not pass it on as it would for a call in its own body. So wrapping a call in 
> another closure changes which object answers.
> {code:groovy}
> class D { String toString() { 'D' } }
> class C {
>     String toString() { 'C' }
>     def single()   { def k = { -> toString() }; k() }
>     def nested()   { def k = { -> def j = { -> toString() }; j() }; k() }
>     def each()     { def r = []; def k = { -> [1].each { r << toString() } }; 
> k(); r[0] }
>     def withEach() { new D().with { def r = []; [1].each { r << toString() }; 
> r[0] } }
> }
> def c = new C()
> assert c.single() == 'C'      // passes
> assert c.nested() == 'C'      // fails: C$_nested_closure1@...
> assert c.each() == 'C'        // fails: C$_each_closure2@...
> assert c.withEach() == 'D'    // fails: C$_withEach_closure3@...
> {code}
> ||Case||up to 5.1.3||6.0.0 dynamic||Expected||
> |closure in a method|closure|C|C|
> |{{new D().with \{ toString() \}}}|closure|D|D|
> |nested closure|inner closure|outer closure|C|
> |{{each \{ toString() \}}} inside a closure|inner closure|outer closure|C|
> |nested closure inside {{with}}|inner closure|outer closure|D|
> Under {{@CompileStatic}}, 6.0.0 still gives the 5.x results; current master 
> gives the "6.0.0 dynamic" results. A lambda in dynamic code is a closure and 
> behaves the same. A statically compiled lambda inside a closure already gives 
> the expected result, so {{() -> toString()}} and {{\{ -> toString() \}}} in 
> the same closure currently differ.
> h3. Expected
> A closure that is the owner or delegate of another closure applies its own 
> resolution rules to such a call, as the user guide states ("A candidate that 
> is itself a closure ... applies these same rules with its own owner, delegate 
> and resolve strategy"). It answers the call itself only when it has no owner 
> or delegate left to ask.
> h3. Unchanged
> Methods that {{Closure}} declares ({{call}}, {{curry}}, ...), explicit 
> receivers ({{owner.toString()}}, {{this.toString()}}), a call on a closure 
> from outside it, {{TO_SELF}}, and a closure with no owner or delegate.
> h3. Notes
> * Dynamic: {{ClosureMetaClass.invokeMethod}} invokes the method found on an 
> owner closure directly.
> * Static: {{StaticTypeCheckingVisitor}} selects the owner closure's own 
> method when the owner is a closure.
> * Tests that pin the current behaviour: 
> {{ClosuresSTCTest.testClosureObjectMethodResolveStrategy}}, 
> {{PackedClosuresTransformTest.dynamicClosuresCallingObjectMethodsInANestedClosureDecline}}
>  and 
> {{PackedClosuresTransformTest.closuresCallingObjectMethodsOnAClosureDecline}}.
>  The packing decline added for GROOVY-12663 may no longer be needed.
> * This is a behaviour change and needs a COMPATIBILITY.md entry.



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

Reply via email to