[
https://issues.apache.org/jira/browse/GROOVY-12479?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18130707#comment-18130707
]
ASF GitHub Bot commented on GROOVY-12479:
-----------------------------------------
codecov-commenter commented on PR #3010:
URL: https://github.com/apache/groovy/pull/3010#issuecomment-6358551562
##
[Codecov](https://app.codecov.io/gh/apache/groovy/pull/3010?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 `69.23077%` with `4 lines` in your changes missing
coverage. Please review.
:white_check_mark: Project coverage is 72.4412%. Comparing base
([`8d2980f`](https://app.codecov.io/gh/apache/groovy/commit/8d2980fd1249cb24b22b91524a4ad71c2c25fb45?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache))
to head
([`f7c95aa`](https://app.codecov.io/gh/apache/groovy/commit/f7c95aaf183295c31cf783c1f145c8ab621d6202?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
:warning: Report is 2 commits behind head on master.
| [Files with missing
lines](https://app.codecov.io/gh/apache/groovy/pull/3010?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
| Patch % | Lines |
|---|---|---|
|
[...groovy/classgen/asm/sc/StaticInvocationWriter.java](https://app.codecov.io/gh/apache/groovy/pull/3010?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fcodehaus%2Fgroovy%2Fclassgen%2Fasm%2Fsc%2FStaticInvocationWriter.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvY29kZWhhdXMvZ3Jvb3Z5L2NsYXNzZ2VuL2FzbS9zYy9TdGF0aWNJbnZvY2F0aW9uV3JpdGVyLmphdmE=)
| 60.0000% | [0 Missing and 2 partials :warning:
](https://app.codecov.io/gh/apache/groovy/pull/3010?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
|
|
[...codehaus/groovy/classgen/asm/InvocationWriter.java](https://app.codecov.io/gh/apache/groovy/pull/3010?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fcodehaus%2Fgroovy%2Fclassgen%2Fasm%2FInvocationWriter.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvY29kZWhhdXMvZ3Jvb3Z5L2NsYXNzZ2VuL2FzbS9JbnZvY2F0aW9uV3JpdGVyLmphdmE=)
| 75.0000% | [0 Missing and 1 partial :warning:
](https://app.codecov.io/gh/apache/groovy/pull/3010?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
|
|
[...ovy/classgen/asm/sc/StaticTypesCallSiteWriter.java](https://app.codecov.io/gh/apache/groovy/pull/3010?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fcodehaus%2Fgroovy%2Fclassgen%2Fasm%2Fsc%2FStaticTypesCallSiteWriter.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvY29kZWhhdXMvZ3Jvb3Z5L2NsYXNzZ2VuL2FzbS9zYy9TdGF0aWNUeXBlc0NhbGxTaXRlV3JpdGVyLmphdmE=)
| 75.0000% | [0 Missing and 1 partial :warning:
](https://app.codecov.io/gh/apache/groovy/pull/3010?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/3010?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
```diff
@@ Coverage Diff @@
## master #3010 +/- ##
==================================================
- Coverage 72.4417% 72.4412% -0.0005%
- Complexity 40682 40699 +17
==================================================
Files 1644 1644
Lines 142897 142909 +12
Branches 26877 26880 +3
==================================================
+ Hits 103517 103525 +8
- Misses 29825 29826 +1
- Partials 9555 9558 +3
```
| [Files with missing
lines](https://app.codecov.io/gh/apache/groovy/pull/3010?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
| Coverage Δ | |
|---|---|---|
|
[...codehaus/groovy/classgen/asm/InvocationWriter.java](https://app.codecov.io/gh/apache/groovy/pull/3010?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fcodehaus%2Fgroovy%2Fclassgen%2Fasm%2FInvocationWriter.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvY29kZWhhdXMvZ3Jvb3Z5L2NsYXNzZ2VuL2FzbS9JbnZvY2F0aW9uV3JpdGVyLmphdmE=)
| `86.2745% <75.0000%> (-0.0891%)` | :arrow_down: |
|
[...ovy/classgen/asm/sc/StaticTypesCallSiteWriter.java](https://app.codecov.io/gh/apache/groovy/pull/3010?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fcodehaus%2Fgroovy%2Fclassgen%2Fasm%2Fsc%2FStaticTypesCallSiteWriter.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvY29kZWhhdXMvZ3Jvb3Z5L2NsYXNzZ2VuL2FzbS9zYy9TdGF0aWNUeXBlc0NhbGxTaXRlV3JpdGVyLmphdmE=)
| `76.2931% <75.0000%> (-0.0113%)` | :arrow_down: |
|
[...groovy/classgen/asm/sc/StaticInvocationWriter.java](https://app.codecov.io/gh/apache/groovy/pull/3010?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fcodehaus%2Fgroovy%2Fclassgen%2Fasm%2Fsc%2FStaticInvocationWriter.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvY29kZWhhdXMvZ3Jvb3Z5L2NsYXNzZ2VuL2FzbS9zYy9TdGF0aWNJbnZvY2F0aW9uV3JpdGVyLmphdmE=)
| `73.3831% <60.0000%> (-0.2350%)` | :arrow_down: |
... and [11 files with indirect coverage
changes](https://app.codecov.io/gh/apache/groovy/pull/3010/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>
> SC: receiver expression is not evaluated when it is used to access a static
> field or call a static method
> ---------------------------------------------------------------------------------------------------------
>
> Key: GROOVY-12479
> URL: https://issues.apache.org/jira/browse/GROOVY-12479
> Project: Groovy
> Issue Type: Bug
> Affects Versions: 4.0.33, 5.1.3, 6.0.0
> Reporter: Paul King
> Assignee: Paul King
> Priority: Major
>
> Under {{@CompileStatic}}, when a static field or static method is reached
> through a receiver expression rather than a class name, the receiver
> expression is never evaluated. Any side effects it has are silently lost.
> Dynamic Groovy and {{@TypeChecked}} evaluate it, as Java does (JLS 15.11.1,
> 15.12.4.1: for a static member the receiver expression is evaluated and the
> result discarded).
> {code:groovy}
> class K { static final String CONST = 'c'; static String stat() { 's' } }
> class Probe {
> static List log = []
> static Class<Integer> pickClass() { log << 'pickClass'; Integer }
> static K pickInstance() { log << 'pickInstance'; new K() }
> }
> @groovy.transform.CompileStatic
> class CS {
> static a() { Probe.pickClass().MAX_VALUE } // static field via
> Class-typed expression
> static b() { Probe.pickInstance().CONST } // static field via
> instance-typed expression
> static c() { Probe.pickInstance().stat() } // static method via
> instance-typed expression
> static d() { Probe.pickClass().valueOf(1) } // static method via
> Class-typed expression
> }
> Probe.log.clear(); CS.a(); assert Probe.log == ['pickClass'] // fails: []
> Probe.log.clear(); CS.b(); assert Probe.log == ['pickInstance'] // fails: []
> Probe.log.clear(); CS.c(); assert Probe.log == ['pickInstance'] // fails: []
> Probe.log.clear(); CS.d(); assert Probe.log == ['pickClass'] // fails: []
> {code}
> The values are correct in every case; only the evaluation of the receiver is
> missing.
> ||Case||@CompileStatic||@TypeChecked||dynamic||
> |{{pickClass().MAX_VALUE}}|not evaluated|evaluated|evaluated|
> |{{pickInstance().CONST}}|not evaluated|evaluated|evaluated|
> |{{pickInstance().stat()}}|not evaluated|-|-|
> |{{pickClass().valueOf(1)}}|not evaluated|-|-|
> Same behaviour in 4.0.32, 5.1.2, 6.0.0 and master.
> *Expected:* the receiver expression is evaluated once, its value discarded,
> and the static member accessed, so the static-compiled result matches dynamic
> Groovy and Java.
> *Workaround:* evaluate the expression separately (e.g. {{def c = pickClass();
> c.MAX_VALUE}}), or access the member through the class name.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)