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

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

testlens-app[bot] commented on PR #3113:
URL: https://github.com/apache/groovy/pull/3113#issuecomment-6535681079

   ## 🚨 TestLens detected 1 failed test 🚨
   
   ### Test Summary
   > [!TIP]
   > Inspect all details with the [TestLens 
CLI](https://testlens.app/docs/features/cli): `testlens pr 3113`
   
   #### [Build and test / lts \(17, 
ubuntu-latest\)](https://github.com/apache/groovy/actions/runs/41142543743/job/124360005709?pr=3113)
 > :test
   
   | Test | Runs | Flakiness |
   |---|---|--:|
   | MethodReferenceTest > 
testMethodReferencesInStaticAndDefaultMethodsOfInterface\(\) | ❌ | 0% 🟢 |
   
   🏷️ Commit: 8ec6ebee1a3a5dd19d325e7d0a7ca9c3cd8fb4a5
   ▶️ Tests:  55748 executed
   🟡 Checks: 7/24 completed
   
   ### Test Failures
   
   <details><summary><strong>MethodReferenceTest > 
testMethodReferencesInStaticAndDefaultMethodsOfInterface()</strong> (:test in 
<a 
href="https://github.com/apache/groovy/actions/runs/41142543743/job/124360005709?pr=3113";>Build
 and test / lts (17, ubuntu-latest)</a>)</summary>
   
   ```
   java.lang.ClassFormatError: Method gstring$I$ctorRef$make$0$1 in class I has 
illegal modifiers: 0x101A
        at java.base/java.lang.ClassLoader.defineClass1(Native Method)
        at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1017)
        at 
java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:150)
        at groovy.lang.GroovyClassLoader.access$000(GroovyClassLoader.java:90)
        at 
groovy.lang.GroovyClassLoader$ClassCollector.createClass(GroovyClassLoader.java:1305)
        at groovy.lang.GroovyClassLoader.collect(GroovyClassLoader.java:284)
        at 
groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:440)
        at 
groovy.lang.GroovyClassLoader.lambda$parseClass$2(GroovyClassLoader.java:378)
        at 
org.codehaus.groovy.runtime.memoize.ConcurrentCommonCache.getAndPut(ConcurrentCommonCache.java:143)
        at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:378)
        at groovy.lang.GroovyShell.parseClass(GroovyShell.java:664)
        at groovy.lang.GroovyShell.parse(GroovyShell.java:677)
        at groovy.lang.GroovyShell.parse(GroovyShell.java:689)
        at groovy.lang.GroovyShell.evaluate(GroovyShell.java:551)
        at groovy.lang.GroovyShell.evaluate(GroovyShell.java:587)
        at groovy.lang.GroovyShell.evaluate(GroovyShell.java:571)
        at groovy.test.GroovyAssert.assertScript(GroovyAssert.java:107)
        at 
groovy.transform.stc.MethodReferenceTest.testMethodReferencesInStaticAndDefaultMethodsOfInterface(MethodReferenceTest.groovy:1613)
   ```
   
   </details>
   
   ### Rerun Controls
   > [!NOTE]
   > Checks are currently running using the configuration below.
   
   Select tests to mute in this pull request:
   
   🔲 MethodReferenceTest > 
testMethodReferencesInStaticAndDefaultMethodsOfInterface\(\) <!

> STC rejects a Closure<R> value assigned to a parameterized functional 
> interface ("Incompatible generic argument types")
> -----------------------------------------------------------------------------------------------------------------------
>
>                 Key: GROOVY-12588
>                 URL: https://issues.apache.org/jira/browse/GROOVY-12588
>             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.TypeChecked // or @CompileStatic
> def m() {
>     Closure<String> c = { 'a' }
>     Supplier<String> s = c
>     s.get()
> }
> assert m() == 'a'
> {code}
> Actual result:
> {noformat}
> [Static type checking] - Incompatible generic argument types. Cannot assign 
> groovy.lang.Closure<java.lang.String> to: 
> java.util.function.Supplier<java.lang.String>
> {noformat}
> Expected result: the script compiles and the closure is coerced to the 
> interface, as it is for a closure literal, for a raw target ({{Supplier s = 
> c}}) and in dynamic Groovy.
> The same error is reported when the value comes from a property, a subscript, 
> a field assignment or a generic method returning a Closure, and for SAM types 
> with parameters such as {{Function<Integer,String>}}. The assignment check 
> accepts Closure to SAM coercion, but the generics check that follows it 
> compares {{Closure<String>}} with {{Supplier<String>}} as if Closure had to 
> implement the interface.
> Seen in 4.0.33, 5.0.8, 6.0.0 and master.
> PR: https://github.com/apache/groovy/pull/3113



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

Reply via email to