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

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

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

   ## 
[Codecov](https://app.codecov.io/gh/apache/groovy/pull/3129?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 `80.00000%` with `2 lines` in your changes missing 
coverage. Please review.
   :white_check_mark: Project coverage is 74.1028%. Comparing base 
([`cd944a5`](https://app.codecov.io/gh/apache/groovy/commit/cd944a5f0ee353126e6f6a484f574b4b53e555fd?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache))
 to head 
([`74a1716`](https://app.codecov.io/gh/apache/groovy/commit/74a17166c9eafb8e9d6123ed162b574e5d387b41?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 master.
   
   | [Files with missing 
lines](https://app.codecov.io/gh/apache/groovy/pull/3129?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
 | Patch % | Lines |
   |---|---|---|
   | 
[...roovy/classgen/asm/sc/StaticTypesLambdaWriter.java](https://app.codecov.io/gh/apache/groovy/pull/3129?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fcodehaus%2Fgroovy%2Fclassgen%2Fasm%2Fsc%2FStaticTypesLambdaWriter.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvY29kZWhhdXMvZ3Jvb3Z5L2NsYXNzZ2VuL2FzbS9zYy9TdGF0aWNUeXBlc0xhbWJkYVdyaXRlci5qYXZh)
 | 80.0000% | [0 Missing and 2 partials :warning: 
](https://app.codecov.io/gh/apache/groovy/pull/3129?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/3129/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/3129?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
   
   ```diff
   @@                Coverage Diff                 @@
   ##               master      #3129        +/-   ##
   ==================================================
   + Coverage     74.1016%   74.1028%   +0.0011%     
   - Complexity      43596      43608        +12     
   ==================================================
     Files            1692       1692                
     Lines          149245     149263        +18     
     Branches        28284      28290         +6     
   ==================================================
   + Hits           110593     110608        +15     
     Misses          28475      28475                
   - Partials        10177      10180         +3     
   ```
   
   | [Files with missing 
lines](https://app.codecov.io/gh/apache/groovy/pull/3129?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
 | Coverage Δ | |
   |---|---|---|
   | 
[...roovy/classgen/asm/sc/StaticTypesLambdaWriter.java](https://app.codecov.io/gh/apache/groovy/pull/3129?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fcodehaus%2Fgroovy%2Fclassgen%2Fasm%2Fsc%2FStaticTypesLambdaWriter.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvY29kZWhhdXMvZ3Jvb3Z5L2NsYXNzZ2VuL2FzbS9zYy9TdGF0aWNUeXBlc0xhbWJkYVdyaXRlci5qYXZh)
 | `90.0356% <80.0000%> (-0.0379%)` | :arrow_down: |
   
   ... and [16 files with indirect coverage 
changes](https://app.codecov.io/gh/apache/groovy/pull/3129/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: a lambda in a trait method calling a trait instance method by implicit 
> this throws ClassCastException: Class cannot be cast to the trait
> --------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: GROOVY-12602
>                 URL: https://issues.apache.org/jira/browse/GROOVY-12602
>             Project: Groovy
>          Issue Type: Bug
>    Affects Versions: 4.0.33, 5.0.8, 6.0.0
>            Reporter: Scott Murphy Heiberg
>            Priority: Major
>
> {code:groovy}
> import java.util.function.Supplier
> @groovy.transform.CompileStatic
> trait U {
>     String getUname() { 'u' }
>     String a() { Supplier<String> s = () -> getUname(); s.get() }
> }
> class C implements U {}
> assert new C().a() == 'u'
> {code}
> Actual:
> {noformat}
> java.lang.ClassCastException: class java.lang.Class cannot be cast to class U
>       at U$Trait$Helper$_a_lambda1.doCall(...)
> {noformat}
> The same happens for a super trait's accessor read as {{uname}} or called as 
> {{getUname()}} in a lambda, for a lambda in a lambda, for a closure in a 
> lambda and for a lambda in a trait field initializer.
> Expected: the assertion passes, as it does without {{@CompileStatic}}, with 
> {{@TypeChecked}}, and with a closure instead of the lambda.
> A closure in a trait method is rehydrated with the trait instance as its this 
> object. A statically compiled lambda is not, and the lambda writer passes the 
> trait helper class as the lambda's this object because the helper method is 
> static. The implicit-this call then casts that class to the trait.
> Seen in 4.0.33, 5.0.8 and 6.0.0.
> PR: https://github.com/apache/groovy/pull/3129



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

Reply via email to