[
https://issues.apache.org/jira/browse/GROOVY-12491?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18140688#comment-18140688
]
ASF GitHub Bot commented on GROOVY-12491:
-----------------------------------------
testlens-app[bot] commented on PR #3025:
URL: https://github.com/apache/groovy/pull/3025#issuecomment-6720387874
## 🚨 Jobs failed without executing tests 🚨
### Failed Jobs without Test Failures
❌ [Build and test / lts \(17,
ubuntu-latest\)](https://github.com/apache/groovy/actions/runs/42471408525/job/128702785112?pr=3025)
❌ [Build and test / lts \(21,
ubuntu-latest\)](https://github.com/apache/groovy/actions/runs/42471408525/job/128702785526?pr=3025)
❌ [Build and test / lts \(25,
ubuntu-latest\)](https://github.com/apache/groovy/actions/runs/42471408525/job/128702785362?pr=3025)
❌ [Build and test for coverage /
test](https://github.com/apache/groovy/actions/runs/42471408533/job/128702784980?pr=3025)
❌ [Generate SNAPSHOT artifacts /
dist](https://github.com/apache/groovy/actions/runs/42471408851/job/128702786754?pr=3025)
❌ [Generate SNAPSHOT distributions /
dist](https://github.com/apache/groovy/actions/runs/42471408515/job/128702785221?pr=3025)
❌ [Lint gate /
lint](https://github.com/apache/groovy/actions/runs/42471408626/job/128702786137?pr=3025)
❌ [Performance check /
test](https://github.com/apache/groovy/actions/runs/42471408624/job/128702785733?pr=3025)
❌ [jmh / test \(bench,
\\\\.bench\\\\.\)](https://github.com/apache/groovy/actions/runs/42471408539/job/128702785378?pr=3025)
❌ [jmh / test \(core-ag,
\\\\.perf\\\\.[A-G]\)](https://github.com/apache/groovy/actions/runs/42471408539/job/128702785425?pr=3025)
❌ [jmh-classic / test \(core-ag,
\\\\.perf\\\\.[A-G]\)](https://github.com/apache/groovy/actions/runs/42471408493/job/128702785070?pr=3025)
❌ [jmh-classic / test \(core-hz,
\\\\.perf\\\\.[H-Z]\)](https://github.com/apache/groovy/actions/runs/42471408493/job/128702785079?pr=3025)
❌ [jmh-classic / test \(grails-ad,
\\\\.perf\\\\.grails\\\\.[A-D]\)](https://github.com/apache/groovy/actions/runs/42471408493/job/128702785150?pr=3025)
❌ [jmh-classic / test \(grails-ez,
\\\\.perf\\\\.grails\\\\.[E-Z]\)](https://github.com/apache/groovy/actions/runs/42471408493/job/128702784936?pr=3025)
🏷️ Commit: 1525177800d98c23ec390e644ef335d938f0f915
▶️ Tests: 0 executed
🟡 Checks: 17/24 completed
### Rerun Controls
Click the checkbox to trigger a rerun:
🔲 **Rerun jobs**
---
_Learn more about TestLens at
[testlens.app/docs](https://testlens.app/docs/features/pr-comment/)._
> 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. The initializers of final trait fields ({{$init$<field>}},
> {{$static$init$<field>}}) get their method targets too, and a helper that
> does not declare {{$init$(TraitType)}} fails compilation with a
> {{GroovyBugError}}.
> With this change a method added to the helper's meta class (for example with
> ExpandoMetaClass) no longer replaces {{$init$}} or a field initializer, as it
> already could not replace {{$static$init$}}. This includes the classes that
> {{withTraits}} and {{as Trait}} generate at run time, which are composed the
> same way.
> PR: https://github.com/apache/groovy/pull/3025
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)