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

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

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

   ## 🚨 TestLens detected 1 failed test 🚨
   
   ### Test Summary
   > [!TIP]
   > Inspect all details with the [TestLens 
CLI](https://testlens.app/docs/features/cli): `testlens pr 3025`
   
   #### [Build and test / lts \(17, 
ubuntu-latest\)](https://github.com/apache/groovy/actions/runs/40171113440/job/121101953368?pr=3025)
 > :test
   
   | Test | Runs | Flakiness |
   |---|---|--:|
   | Groovy12142 > testDocumentedGroovySweepReleasesAnIsolatedRuntime\(\) | ❌ | 
0% 🟢 |
   
   🏷️ Commit: c29596f9fd39396d75e87cd92e3f7c7cfcc7bc25
   ▶️ Tests:  7077 executed
   🟡 Checks: 5/31 completed
   
   ### Test Failures
   
   <details><summary><strong>Groovy12142 > 
testDocumentedGroovySweepReleasesAnIsolatedRuntime()</strong> (:test in <a 
href="https://github.com/apache/groovy/actions/runs/40171113440/job/121101953368?pr=3025";>Build
 and test / lts (17, ubuntu-latest)</a>)</summary>
   
   ```
   org.opentest4j.AssertionFailedError: the documented sweep must release the 
class loader of a discarded runtime ==> expected: <true> but was: <false>
        at org.junit.jupiter.api.Assertions.assertTrue(Assertions.java:232)
        at bugs.Groovy12142.assertLoaderCollected(Groovy12142.groovy:458)
        at 
bugs.Groovy12142.testDocumentedGroovySweepReleasesAnIsolatedRuntime(Groovy12142.groovy:434)
   ```
   
   |expected|actual|
   |---|---|
   |<s>true</s>|<b>false</b>|
   
   </details>
   
   ### Rerun Controls
   > [!NOTE]
   > Checks are currently running using the configuration below.
   
   Select tests to mute in this pull request:
   
   🔲 Groovy12142 > testDocumentedGroovySweepReleasesAnIsolatedRuntime\(\) <!

> Classes implementing a trait call the helper's $init$ through the meta class
> ----------------------------------------------------------------------------
>
>                 Key: GROOVY-12491
>                 URL: https://issues.apache.org/jira/browse/GROOVY-12491
>             Project: Groovy
>          Issue Type: Bug
>          Components: Compiler, Static compilation
>    Affects Versions: 6.0.0
>            Reporter: Scott Murphy Heiberg
>            Priority: Major
>
> When a class implements a trait, {{TraitComposer.applyTrait}} adds 
> {{Helper.$init$(this)}} to the class's object initializer without a method 
> target (the {{$static$init$}} call beside it has one). Every constructor 
> therefore dispatches the call through the meta class of the helper, even in 
> {{@CompileStatic}} classes:
> {code:groovy}
> trait Greeting { String greeting = 'hello' }
> @CompileStatic class StaticGreeter implements Greeting {}
> class DynamicGreeter implements Greeting {}
> {code}
> * {{StaticGreeter.<init>}}: {{ldc Greeting$Trait$Helper; ldc "$init$"; ... 
> invokestatic ScriptBytecodeAdapter.invokeMethodN}}
> * {{DynamicGreeter.<init>}}: {{invokedynamic 
> invoke:(Class,LDynamicGreeter;)Object}}
> * the static initializer of both: {{invokestatic 
> Greeting$Trait$Helper.$static$init$(Class)}}
> This costs a dynamic dispatch on every instantiation. A GraalVM native image 
> has to register every trait helper's {{$init$}} for reflection, or 
> construction fails with "No signature of static method: $init$".
> Proposed fix: give the {{$init$}} call its method target, the 
> {{$init$(TraitType)}} method the helper declares, so constructors call it 
> with {{invokestatic}} in dynamic, {{@TypeChecked}} and {{@CompileStatic}} 
> classes.
> PR: https://github.com/apache/groovy/pull/3025



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

Reply via email to