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

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

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

   ## 🚨 TestLens detected 4 failed tests 🚨
   
   ### Test Summary
   > [!TIP]
   > Inspect all details with the [TestLens 
CLI](https://testlens.app/docs/features/cli): `testlens pr 3113`
   
   #### [Build and test / lts \(17, 
macos-latest\)](https://github.com/apache/groovy/actions/runs/44979288653/job/137076026208?pr=3113)
 > :test
   
   | Test | Runs | Flakiness |
   |---|---|--:|
   | TraitASTTransformationTest > <span 
title='testSuperTraitStaticAccessorAsPropertyInLambdaStaticallyCompiledByCustomizer()'>testSuperTraitStaticAccessorAsPropertyInLambdaStaticallyComp…</span>
 | ❌ | 0%&nbsp;🟢 |
   | TraitMemberAccessMatrix > declaredInstanceProperty\(\) | ❌ | 0%&nbsp;🟢 |
   | TraitMemberAccessMatrix > declaredInstancePropertyRedeclaredByClass\(\) | 
❌ | 0%&nbsp;🟢 |
   | TraitMemberAccessMatrix > instanceAccessorOnlyProperty\(\) | ❌ | 0%&nbsp;🟢 
|
   
   🏷️ Commit: b38eea84771b155179add852baae2775a2287054
   ▶️ Tests:  98744 executed
   🟡 Checks: 10/24 completed
   
   ### Test Failures
   
   <details><summary><strong>TraitASTTransformationTest > 
testSuperTraitStaticAccessorAsPropertyInLambdaStaticallyCompiledByCustomizer()</strong>
 (:test in <a 
href="https://github.com/apache/groovy/actions/runs/44979288653/job/137076026208?pr=3113";>Build
 and test / lts (17, macos-latest)</a>)</summary>
   
   ```
   org.codehaus.groovy.control.MultipleCompilationErrorsException: startup 
failed:
   Script2.groovy: -1: Cannot use package-private class T$4 from class T: T$4 
is defined by another class loader, so the JVM refuses this access. Use 
@CompileDynamic to reach it through the meta-class @ line -1, column 1.
   Script2.groovy: -1: Cannot use package-private class T$4 from class T: T$4 
is defined by another class loader, so the JVM refuses this access. Use 
@CompileDynamic to reach it through the meta-class @ line -1, column 1.
   Script2.groovy: -1: Cannot use package-private class T$4 from class T: T$4 
is defined by another class loader, so the JVM refuses this access. Use 
@CompileDynamic to reach it through the meta-class @ line -1, column 1.
   3 errors
   
        at 
org.codehaus.groovy.control.ErrorCollector.failIfErrors(ErrorCollector.java:350)
        at 
org.codehaus.groovy.control.CompilationUnit$IPrimaryClassNodeOperation.doPhaseOperation(CompilationUnit.java:1198)
        at 
org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:818)
        at 
org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:771)
        at 
groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:466)
        at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:401)
        at groovy.lang.GroovyShell.parseClass(GroovyShell.java:677)
        at groovy.lang.GroovyShell.parse(GroovyShell.java:690)
        at groovy.lang.GroovyShell.parse(GroovyShell.java:702)
        at groovy.lang.GroovyShell.evaluate(GroovyShell.java:553)
        at groovy.lang.GroovyShell.evaluate(GroovyShell.java:565)
        at 
org.codehaus.groovy.transform.traitx.TraitASTTransformationTest.testSuperTraitStaticAccessorAsPropertyInLambdaStaticallyCompiledByCustomizer(TraitASTTransformationTest.groovy:3091)
   ```
   
   </details>
   <details><summary><strong>TraitMemberAccessMatrix > 
declaredInstanceProperty()</strong> (:test in <a 
href="https://github.com/apache/groovy/actions/runs/44979288653/job/137076026208?pr=3113";>Build
 and test / lts (17, macos-latest)</a>)</summary>
   
   ```
   java.lang.AssertionError: lambda getLabel(), @CompileStatic: now follows the 
rule ('class'); remove it from the open cells. Expression: problems.empty
        at 
org.codehaus.groovy.runtime.InvokerHelper.createAssertError(InvokerHelper.java:639)
        at 
org.codehaus.groovy.transform.traitx.TraitMemberAccessMatrix.check(TraitMemberAccessMatrix.groovy:160)
        at 
org.codehaus.groovy.transform.traitx.TraitMemberAccessMatrix.declaredInstanceProperty(TraitMemberAccessMatrix.groovy:80)
   ```
   
   </details>
   <details><summary><strong>TraitMemberAccessMatrix > 
declaredInstancePropertyRedeclaredByClass()</strong> (:test in <a 
href="https://github.com/apache/groovy/actions/runs/44979288653/job/137076026208?pr=3113";>Build
 and test / lts (17, macos-latest)</a>)</summary>
   
   ```
   java.lang.AssertionError: lambda getLabel(), @CompileStatic: now follows the 
rule ('class'); remove it from the open cells. Expression: problems.empty
        at 
org.codehaus.groovy.runtime.InvokerHelper.createAssertError(InvokerHelper.java:639)
        at 
org.codehaus.groovy.transform.traitx.TraitMemberAccessMatrix.check(TraitMemberAccessMatrix.groovy:160)
        at 
org.codehaus.groovy.transform.traitx.TraitMemberAccessMatrix.declaredInstancePropertyRedeclaredByClass(TraitMemberAccessMatrix.groovy:87)
   ```
   
   </details>
   <details><summary><strong>TraitMemberAccessMatrix > 
instanceAccessorOnlyProperty()</strong> (:test in <a 
href="https://github.com/apache/groovy/actions/runs/44979288653/job/137076026208?pr=3113";>Build
 and test / lts (17, macos-latest)</a>)</summary>
   
   ```
   java.lang.AssertionError: lambda getLabel(), @CompileStatic: now follows the 
rule ('class'); remove it from the open cells. Expression: problems.empty
        at 
org.codehaus.groovy.runtime.InvokerHelper.createAssertError(InvokerHelper.java:639)
        at 
org.codehaus.groovy.transform.traitx.TraitMemberAccessMatrix.check(TraitMemberAccessMatrix.groovy:160)
        at 
org.codehaus.groovy.transform.traitx.TraitMemberAccessMatrix.instanceAccessorOnlyProperty(TraitMemberAccessMatrix.groovy:73)
   ```
   
   </details>
   
   ### Rerun Controls
   > [!NOTE]
   > Checks are currently running using the configuration below.
   
   Select tests to mute in this pull request:
   
   🔲 TraitASTTransformationTest > 
testSuperTraitStaticAccessorAsPropertyInLambdaStaticallyCompiledByCustomizer\(\)
 <!

> 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