[
https://issues.apache.org/jira/browse/GROOVY-12664?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18137462#comment-18137462
]
ASF GitHub Bot commented on GROOVY-12664:
-----------------------------------------
codecov-commenter commented on PR #3185:
URL: https://github.com/apache/groovy/pull/3185#issuecomment-6611281976
##
[Codecov](https://app.codecov.io/gh/apache/groovy/pull/3185?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.1519%. 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
([`1b2c1fd`](https://app.codecov.io/gh/apache/groovy/commit/1b2c1fd680110af3cb6ec033965ebec0b64fe81b?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>
[](https://app.codecov.io/gh/apache/groovy/pull/3185?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
```diff
@@ Coverage Diff @@
## master #3185 +/- ##
==================================================
- Coverage 74.1533% 74.1519% -0.0013%
- Complexity 43751 43754 +3
==================================================
Files 1692 1692
Lines 149516 149516
Branches 28366 28366
==================================================
- Hits 110871 110869 -2
- Misses 28448 28452 +4
+ Partials 10197 10195 -2
```
| [Files with missing
lines](https://app.codecov.io/gh/apache/groovy/pull/3185?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/3185?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.0496% <100.0000%> (+1.0638%)` | :arrow_up: |
... and [8 files with indirect coverage
changes](https://app.codecov.io/gh/apache/groovy/pull/3185/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>
> Implicit-this call to an Object extension method inside a closure runs twice
> when delegate and owner cannot take it
> -------------------------------------------------------------------------------------------------------------------
>
> Key: GROOVY-12664
> URL: https://issues.apache.org/jira/browse/GROOVY-12664
> Project: Groovy
> Issue Type: Bug
> Affects Versions: 7.0.0-alpha-1, 6.0.0
> Reporter: Scott Murphy Heiberg
> Priority: Major
>
> {code:groovy}
> int count = 0
> def c = { -> with { ++count } }
> c.resolveStrategy = Closure.DELEGATE_ONLY
> c.delegate = null
> def result = c()
> println "result=$result count=$count"
> {code}
> *Actual* (6.0.0 and master): {{result=2 count=2}}. The {{with}} block runs
> twice. Calling the metaclass directly, as
> {{c.metaClass.invokeMethod(this.getClass(), c, 'sprintf', ['%d', 42] as
> Object[], false, true)}}, throws MissingMethodException.
> *Expected* (as in 4.0.33 and 5.0.8): {{result=1 count=1}}, and the direct
> metaclass call returns "42".
> The same happens with a delegate that is the closure itself, after
> dehydrate() with DELEGATE_ONLY, after rehydrate(null, null, null) with
> OWNER_ONLY, and with @TypeChecked.
> Cause: GROOVY-11858 made {{ClosureMetaClass.invokeMethod}} defer a
> non-closure method so that delegate and owner are tried first. When neither
> can take the call, the deferred method is invoked but its result is not
> returned, and MissingMethodException is thrown. The indy fallback then
> retries through GroovyObject.invokeMethod and calls the method again.
> Verified: 6.0.0 and master affected; 4.0.33 and 5.0.8 not affected.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)