[
https://issues.apache.org/jira/browse/GROOVY-12561?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18148979#comment-18148979
]
ASF GitHub Bot commented on GROOVY-12561:
-----------------------------------------
testlens-app[bot] commented on PR #3090:
URL: https://github.com/apache/groovy/pull/3090#issuecomment-7073730800
## 🚨 TestLens detected 1 failed test 🚨
### Test Summary
> [!TIP]
> Inspect all details with the [TestLens
CLI](https://testlens.app/docs/features/cli): `testlens pr 3090`
#### [Build and test / lts \(17,
ubuntu-latest\)](https://github.com/apache/groovy/actions/runs/44979380279/job/137076304914?pr=3090)
> :test
| Test | Runs | Flakiness |
|---|---|--:|
| TraitASTTransformationTest > <span
title='testSuperTraitStaticAccessorAsPropertyInLambdaStaticallyCompiledByCustomizer()'>testSuperTraitStaticAccessorAsPropertyInLambdaStaticallyComp…</span>
| ❌ | 0% 🟢 |
🏷️ Commit: 849e9da4c54fa5804b24b1784e4e91228cf385fc
▶️ Tests: 125089 executed
🟡 Checks: 15/25 completed
### Test Failures
<details><summary><strong>TraitASTTransformationTest >
testSuperTraitStaticAccessorAsPropertyInLambdaStaticallyCompiledByCustomizer()</strong>
(:test in <a
href="https://github.com/apache/groovy/actions/runs/44979380279/job/137076304914?pr=3090">Build
and test / lts (17, 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\(\)
<!
> SC: a closure passed or assigned for a type parameter bound to a functional
> interface is stored unconverted
> -----------------------------------------------------------------------------------------------------------
>
> Key: GROOVY-12561
> URL: https://issues.apache.org/jira/browse/GROOVY-12561
> Project: Groovy
> Issue Type: Bug
> Components: Static compilation
> Affects Versions: 4.0.33, 5.0.8, 6.0.0
> Reporter: Scott Murphy Heiberg
> Priority: Major
>
> Under {{@CompileStatic}}, a closure written for a slot declared with a type
> parameter is stored as the closure itself when the call or assignment binds
> the type parameter to a functional interface. This happens for an argument,
> such as {{E}} of {{List.add(E)}} or {{V}} of {{Map.put(K, V)}}, and for an
> assignment, through {{putAt}} of a {{Map<String, Function<String, String>>}}
> or a {{List<Supplier<String>>}}, or through the setter or field of a
> {{Holder<T>}} property for a {{Holder<Supplier<String>>}}. The erasure of the
> slot is {{Object}}, so nothing converts the closure, and a later call of the
> interface method fails:
> {code:groovy}
> import java.util.function.Function
> @groovy.transform.CompileStatic
> Map<String, Function<String, String>> make() {
> Map<String, Function<String, String>> map = [:]
> map['shout'] = { String s -> s + '!' }
> map.put('whisper') { String s -> s.toLowerCase() }
> map
> }
> make().shout.apply('hi') // MissingMethodException: No signature of method:
> apply ... (a Closure was stored)
> {code}
> The same holds for {{list.add { ... }}}, {{list << { ... }}}, varargs,
> constructor arguments, {{map?['k'] = ...}}, {{map.k = ...}}, {{holder.value =
> ...}}, {{box.@field = ...}} and the named constructor argument {{new
> Holder<Supplier<String>>(value: { ... })}}. Assigning to a variable of the
> interface type converts the closure.
> Expected: the closure is converted to the interface the call or assignment
> binds the type parameter to, as it is for a variable of that type.
> Lambdas and method references for such a parameter are GROOVY-10979.
> PR: https://github.com/apache/groovy/pull/3090
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)