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

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

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

   ## 
[Codecov](https://app.codecov.io/gh/apache/groovy/pull/3126?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 `70.58824%` with `5 lines` in your changes missing 
coverage. Please review.
   :white_check_mark: Project coverage is 74.1018%. 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 
([`f43beff`](https://app.codecov.io/gh/apache/groovy/commit/f43beffdc7288dbf40010a9be8a55f577723175e?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/3126?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/transform/stc/StaticTypeCheckingSupport.java](https://app.codecov.io/gh/apache/groovy/pull/3126?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fcodehaus%2Fgroovy%2Ftransform%2Fstc%2FStaticTypeCheckingSupport.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvY29kZWhhdXMvZ3Jvb3Z5L3RyYW5zZm9ybS9zdGMvU3RhdGljVHlwZUNoZWNraW5nU3VwcG9ydC5qYXZh)
 | 78.5714% | [0 Missing and 3 partials :warning: 
](https://app.codecov.io/gh/apache/groovy/pull/3126?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/3126?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)
 | 33.3333% | [0 Missing and 2 partials :warning: 
](https://app.codecov.io/gh/apache/groovy/pull/3126?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/3126/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/3126?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
   
   ```diff
   @@                Coverage Diff                 @@
   ##               master      #3126        +/-   ##
   ==================================================
   + Coverage     74.1016%   74.1018%   +0.0001%     
   - Complexity      43596      43612        +16     
   ==================================================
     Files            1692       1692                
     Lines          149245     149269        +24     
     Branches        28284      28294        +10     
   ==================================================
   + Hits           110593     110611        +18     
   + Misses          28475      28474         -1     
   - Partials        10177      10184         +7     
   ```
   
   | [Files with missing 
lines](https://app.codecov.io/gh/apache/groovy/pull/3126?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
 | Coverage Δ | |
   |---|---|---|
   | 
[...roovy/transform/stc/StaticTypeCheckingVisitor.java](https://app.codecov.io/gh/apache/groovy/pull/3126?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)
 | `88.1714% <33.3333%> (-0.0376%)` | :arrow_down: |
   | 
[...roovy/transform/stc/StaticTypeCheckingSupport.java](https://app.codecov.io/gh/apache/groovy/pull/3126?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fcodehaus%2Fgroovy%2Ftransform%2Fstc%2FStaticTypeCheckingSupport.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvY29kZWhhdXMvZ3Jvb3Z5L3RyYW5zZm9ybS9zdGMvU3RhdGljVHlwZUNoZWNraW5nU3VwcG9ydC5qYXZh)
 | `81.9644% <78.5714%> (+0.0295%)` | :arrow_up: |
   
   ... and [14 files with indirect coverage 
changes](https://app.codecov.io/gh/apache/groovy/pull/3126/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>




> STC accepts a Closure<R> value passed to or returned as a functional 
> interface whose method does not return R
> -------------------------------------------------------------------------------------------------------------
>
>                 Key: GROOVY-12599
>                 URL: https://issues.apache.org/jira/browse/GROOVY-12599
>             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 // or @TypeChecked
> class C {
>     static String take(Supplier<String> s) { s.get().toLowerCase() }
>     static Supplier<String> make() { Closure<Integer> c = { 1 }; c }
>     static void main(args) {
>         Closure<Integer> c = { 1 }
>         take(c)
>         make().get().toLowerCase()
>     }
> }
> {code}
> Actual: the code compiles. Under static compilation both calls throw
> {noformat}
> java.lang.ClassCastException: class java.lang.Integer cannot be cast to class 
> java.lang.String
> {noformat}
> (MissingMethodException under @TypeChecked). The same happens for an instance 
> of a non-generic subclass such as {{class D extends Closure<Integer>}} passed 
> as the argument.
> Expected: compile errors, as for a closure literal ("Cannot return value of 
> type int for closure expecting java.lang.String"):
> {noformat}
> Cannot call C#take(java.util.function.Supplier<java.lang.String>) with 
> arguments [groovy.lang.Closure<java.lang.Integer>]
> Cannot return value of type groovy.lang.Closure<java.lang.Integer> for method 
> returning java.util.function.Supplier<java.lang.String>
> {noformat}
> For a method argument, 
> StaticTypeCheckingSupport.typeCheckMethodArgumentWithGenerics accepts any 
> Closure for a SAM-type parameter and assumes the return type was checked 
> earlier. That is only true for a closure literal. For a return statement, 
> generics are compared only when the value's type implements the return type, 
> which Closure does not for most SAM types.
> Seen in 4.0.33, 5.0.8 and 6.0.0.
> PR: https://github.com/apache/groovy/pull/3126



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

Reply via email to