[
https://issues.apache.org/jira/browse/GROOVY-12829?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18150222#comment-18150222
]
ASF GitHub Bot commented on GROOVY-12829:
-----------------------------------------
codecov-commenter commented on PR #3354:
URL: https://github.com/apache/groovy/pull/3354#issuecomment-7128322954
##
[Codecov](https://app.codecov.io/gh/apache/groovy/pull/3354?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 74.9564%. Comparing base
([`09e84fa`](https://app.codecov.io/gh/apache/groovy/commit/09e84fa4b0d4c37a5ac2efc48dfd2db93a84cab7?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache))
to head
([`4ff15ab`](https://app.codecov.io/gh/apache/groovy/commit/4ff15abde5a403c22b6f092d740b8e552168ad40?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
:warning: Report is 3 commits behind head on master.
| [Files with missing
lines](https://app.codecov.io/gh/apache/groovy/pull/3354?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/3354?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/3354?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/3354?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/3354?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>
[](https://app.codecov.io/gh/apache/groovy/pull/3354?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
```diff
@@ Coverage Diff @@
## master #3354 +/- ##
==================================================
+ Coverage 74.9518% 74.9564% +0.0047%
- Complexity 48908 48929 +21
==================================================
Files 1768 1768
Lines 161213 161251 +38
Branches 31728 31742 +14
==================================================
+ Hits 120832 120868 +36
+ Misses 28968 28966 -2
- Partials 11413 11417 +4
```
| [Files with missing
lines](https://app.codecov.io/gh/apache/groovy/pull/3354?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/3354?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=)
| `89.3194% <ø> (ø)` | |
|
[...oovy/classgen/asm/sc/StaticTypesClosureWriter.java](https://app.codecov.io/gh/apache/groovy/pull/3354?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==)
| `69.4118% <ø> (-1.1765%)` | :arrow_down: |
|
[...roovy/transform/stc/StaticTypeCheckingVisitor.java](https://app.codecov.io/gh/apache/groovy/pull/3354?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.9560% <50.0000%> (+0.0389%)` | :arrow_up: |
|
[...aus/groovy/runtime/metaclass/ClosureMetaClass.java](https://app.codecov.io/gh/apache/groovy/pull/3354?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==)
| `75.8427% <33.3333%> (-0.3613%)` | :arrow_down: |
... and [11 files with indirect coverage
changes](https://app.codecov.io/gh/apache/groovy/pull/3354/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
>
> 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)