[
https://issues.apache.org/jira/browse/GROOVY-12607?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18135635#comment-18135635
]
ASF GitHub Bot commented on GROOVY-12607:
-----------------------------------------
codecov-commenter commented on PR #3134:
URL: https://github.com/apache/groovy/pull/3134#issuecomment-6539957802
##
[Codecov](https://app.codecov.io/gh/apache/groovy/pull/3134?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.1068%. 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
([`60c869d`](https://app.codecov.io/gh/apache/groovy/commit/60c869da04bf924e2c8233a7cdff1b4af0ab1845?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.
<details><summary>Additional details and impacted files</summary>
[](https://app.codecov.io/gh/apache/groovy/pull/3134?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
```diff
@@ Coverage Diff @@
## master #3134 +/- ##
==================================================
+ Coverage 74.1016% 74.1068% +0.0051%
- Complexity 43596 43610 +14
==================================================
Files 1692 1692
Lines 149245 149259 +14
Branches 28284 28289 +5
==================================================
+ Hits 110593 110611 +18
+ Misses 28475 28471 -4
Partials 10177 10177
```
| [Files with missing
lines](https://app.codecov.io/gh/apache/groovy/pull/3134?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/3134?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.2215% <100.0000%> (+0.0125%)` | :arrow_up: |
... and [10 files with indirect coverage
changes](https://app.codecov.io/gh/apache/groovy/pull/3134/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 method pointer or method reference whose method return type
> does not fit the target functional interface
> ----------------------------------------------------------------------------------------------------------------------
>
> Key: GROOVY-12607
> URL: https://issues.apache.org/jira/browse/GROOVY-12607
> 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
> class C {
> int intMethod() { 1 }
> Supplier<String> f() { this.&intMethod }
> String take(Supplier<String> s) { s.get() }
> def g() { take(this::intMethod) }
> def h() { Supplier<String> s = this::intMethod; s.get().toUpperCase() }
> }
> new C().h()
> {code}
> Actual: the class compiles. At run time the supplier returns an Integer, so
> the script fails with {{ClassCastException: class java.lang.Integer cannot be
> cast to class java.lang.String}} (under @TypeChecked: MissingMethodException
> for toUpperCase on Integer). The same happens for a Boolean supplier from a
> String-returning method and a Long supplier from an int-returning method,
> with .& or ::, returned, passed or assigned. A method pointer (.&) that is
> returned or assigned is not checked at all, so even a method returning an
> Integer supplier as this.&stringMethod compiles.
> Expected: a compile error such as "Invalid return type: int is not
> convertible to java.lang.String", as for the equivalent lambda.
> Cause: the return-type check for method pointers and references uses
> assignment compatibility, which allows conversions (to String, Boolean, wider
> number wrappers) that a method pointer or reference never performs. A method
> pointer gets no target type when it is returned or assigned.
> Seen in 4.0.33, 5.0.8 and 6.0.0.
> PR: https://github.com/apache/groovy/pull/3134
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)