[
https://issues.apache.org/jira/browse/GROOVY-12599?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18148999#comment-18148999
]
ASF GitHub Bot commented on GROOVY-12599:
-----------------------------------------
testlens-app[bot] commented on PR #3126:
URL: https://github.com/apache/groovy/pull/3126#issuecomment-7074342557
## 🚨 TestLens detected 1 failed test 🚨
### Test Summary
> [!TIP]
> Inspect all details with the [TestLens
CLI](https://testlens.app/docs/features/cli): `testlens pr 3126`
#### [Build and test / lts \(25,
ubuntu-latest\)](https://github.com/apache/groovy/actions/runs/44983500858/job/137088920321?pr=3126)
> :test
| Test | Runs | Flakiness |
|---|---|--:|
| TraitASTTransformationTest > <span
title='testSuperTraitStaticAccessorAsPropertyInLambdaStaticallyCompiledByCustomizer()'>testSuperTraitStaticAccessorAsPropertyInLambdaStaticallyComp…</span>
| ❌ | 0% 🟢 |
🏷️ Commit: 51aedcd5bd622c52250f88d449f921ab717bcb6a
▶️ Tests: 108678 executed
🟡 Checks: 14/24 completed
### Test Failures
<details><summary><strong>TraitASTTransformationTest >
testSuperTraitStaticAccessorAsPropertyInLambdaStaticallyCompiledByCustomizer()</strong>
(:test in <a
href="https://github.com/apache/groovy/actions/runs/44983500858/job/137088920321?pr=3126">Build
and test / lts (25, ubuntu-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>
### Rerun Controls
> [!NOTE]
> Checks are currently running using the configuration below.
Select tests to mute in this pull request:
🔲 TraitASTTransformationTest >
testSuperTraitStaticAccessorAsPropertyInLambdaStaticallyCompiledByCustomizer\(\)
<!
> 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)