[
https://issues.apache.org/jira/browse/GROOVY-11800?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18037525#comment-18037525
]
ASF GitHub Bot commented on GROOVY-11800:
-----------------------------------------
codecov-commenter commented on PR #2332:
URL: https://github.com/apache/groovy/pull/2332#issuecomment-3518325708
##
[Codecov](https://app.codecov.io/gh/apache/groovy/pull/2332?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 `79.16667%` with `5 lines` in your changes missing
coverage. Please review.
:white_check_mark: Project coverage is 66.9931%. Comparing base
([`fc8b34a`](https://app.codecov.io/gh/apache/groovy/commit/fc8b34aaa76a5e19846e1d4f77cf39e9227d9690?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache))
to head
([`e4b4b6e`](https://app.codecov.io/gh/apache/groovy/commit/e4b4b6ea826f9090088f096bbfb63c93d01f972a?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
| [Files with missing
lines](https://app.codecov.io/gh/apache/groovy/pull/2332?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
| Patch % | Lines |
|---|---|---|
|
[...odehaus/groovy/transform/LogASTTransformation.java](https://app.codecov.io/gh/apache/groovy/pull/2332?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fcodehaus%2Fgroovy%2Ftransform%2FLogASTTransformation.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvY29kZWhhdXMvZ3Jvb3Z5L3RyYW5zZm9ybS9Mb2dBU1RUcmFuc2Zvcm1hdGlvbi5qYXZh)
| 79.1667% | [0 Missing and 5 partials :warning:
](https://app.codecov.io/gh/apache/groovy/pull/2332?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/2332?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
```diff
@@ Coverage Diff @@
## master #2332 +/- ##
==================================================
- Coverage 66.9937% 66.9931% -0.0006%
- Complexity 29330 29331 +1
==================================================
Files 1382 1382
Lines 116614 116612 -2
Branches 20433 20432 -1
==================================================
- Hits 78124 78122 -2
- Misses 32056 32058 +2
+ Partials 6434 6432 -2
```
| [Files with missing
lines](https://app.codecov.io/gh/apache/groovy/pull/2332?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
| Coverage Δ | |
|---|---|---|
|
[...odehaus/groovy/transform/LogASTTransformation.java](https://app.codecov.io/gh/apache/groovy/pull/2332?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fcodehaus%2Fgroovy%2Ftransform%2FLogASTTransformation.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvY29kZWhhdXMvZ3Jvb3Z5L3RyYW5zZm9ybS9Mb2dBU1RUcmFuc2Zvcm1hdGlvbi5qYXZh)
| `68.3761% <79.1667%> (+0.3088%)` | :arrow_up: |
... and [2 files with indirect coverage
changes](https://app.codecov.io/gh/apache/groovy/pull/2332/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>
> Unqualified member access in empty array tap resolves incorrectly in Groovy 5
> -----------------------------------------------------------------------------
>
> Key: GROOVY-11800
> URL: https://issues.apache.org/jira/browse/GROOVY-11800
> Project: Groovy
> Issue Type: Bug
> Affects Versions: 5.0.2
> Reporter: Stephen Albrecht
> Assignee: Eric Milles
> Priority: Major
>
> In migrating to Groovy 5 I had to prepend certain slf4j `log` calls with
> `this` or else they would throw a RuntimeException. Below is a reproducible
> example.
> build.gradle dependencies
> {code:java}
> dependencies {
> implementation 'org.apache.groovy:groovy:5.0.2'
> implementation 'ch.qos.logback:logback-core:1.5.20'
> implementation 'ch.qos.logback:logback-classic:1.5.20'
> } {code}
> Main.groovy
> {code:java}
> package org.example
> import groovy.util.logging.Slf4j
> @Slf4j
> class Foo {
> def bar() {
> [''].tap {
> log.info "Logs in Groovy 4 and 5"
> }
> [].tap {
> log.info "Logs in Groovy 4, fails in Groovy 5"
> }
> }
> }
> new Foo().bar(){code}
> Output
> {code:java}
> 15:12:45.605 [main] INFO org.example.Foo -- Logs in Groovy 4 and 5
> Caught: org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot
> cast object '[]' with class 'java.util.ArrayList' to class 'org.slf4j.Logger'
> due to: groovy.lang.GroovyRuntimeException: Could not find matching
> constructor for: org.slf4j.Logger()
> org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast
> object '[]' with class 'java.util.ArrayList' to class 'org.slf4j.Logger' due
> to: groovy.lang.GroovyRuntimeException: Could not find matching constructor
> for: org.slf4j.Logger()
> at org.example.Foo$_bar_closure2.doCall(Main.groovy:12)
> at org.example.Foo.bar(Main.groovy:11)
> at org.example.Main.run(Main.groovy:17)
> Suppressed: groovy.lang.GroovyRuntimeException: Could not find matching
> constructor for: org.slf4j.Logger(ArrayList)
> at groovy.lang.MetaClassImpl.invokeConstructor(MetaClassImpl.java:1797)
> at groovy.lang.MetaClassImpl.invokeConstructor(MetaClassImpl.java:1572)
> at
> org.codehaus.groovy.runtime.InvokerHelper.invokeConstructorOf(InvokerHelper.java:666)
> at
> org.codehaus.groovy.runtime.typehandling.DefaultTypeTransformation.continueCastOnSAM(DefaultTypeTransformation.java:400)
> at
> org.codehaus.groovy.runtime.typehandling.DefaultTypeTransformation.continueCastOnNumber(DefaultTypeTransformation.java:339)
> at
> org.codehaus.groovy.runtime.typehandling.DefaultTypeTransformation.castToType(DefaultTypeTransformation.java:258)
> at
> org.codehaus.groovy.vmplugin.v8.IndyInterface.fromCache(IndyInterface.java:344)
> at org.example.Foo$_bar_closure2.doCall(Main.groovy:12)
> at
> java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
> at java.base/java.lang.reflect.Method.invoke(Method.java:565)
> at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:338)
> at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:274)
> at
> org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:270)
> at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1008)
> at groovy.lang.Closure.call(Closure.java:471)
> at groovy.lang.Closure.call(Closure.java:460)
> at
> org.codehaus.groovy.runtime.DefaultGroovyMethods.callWithDelegateAndParameter(DefaultGroovyMethods.java:276)
> at
> org.codehaus.groovy.runtime.DefaultGroovyMethods.tap(DefaultGroovyMethods.java:14853)
> at org.codehaus.groovy.runtime.dgm$1164.doMethodInvoke(Unknown Source)
> at
> org.codehaus.groovy.vmplugin.v8.IndyInterface.fromCache(IndyInterface.java:344)
> at org.example.Foo.bar(Main.groovy:11)
> at
> org.codehaus.groovy.vmplugin.v8.IndyInterface.fromCache(IndyInterface.java:344)
> at org.example.Main.run(Main.groovy:17)
> at
> groovy.lang.GroovyShell.runScriptOrMainOrTestOrRunnable(GroovyShell.java:290)
> at groovy.lang.GroovyShell.run(GroovyShell.java:422)
> at groovy.lang.GroovyShell.run(GroovyShell.java:411)
> at groovy.ui.GroovyMain.processOnce(GroovyMain.java:649)
> at groovy.ui.GroovyMain.run(GroovyMain.java:389)
> at groovy.ui.GroovyMain$GroovyCommand.process(GroovyMain.java:313)
> at groovy.ui.GroovyMain.processArgs(GroovyMain.java:141)
> at groovy.ui.GroovyMain.main(GroovyMain.java:114)
> at
> java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
> at java.base/java.lang.reflect.Method.invoke(Method.java:565)
> at org.codehaus.groovy.tools.GroovyStarter.rootLoader(GroovyStarter.java:115)
> at org.codehaus.groovy.tools.GroovyStarter.main(GroovyStarter.java:37){code}
> I would expect `log` to resolve correctly in both cases, and IntelliJ flags
> the `this` workaround as an unnecessary qualified reference.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)