[
https://issues.apache.org/jira/browse/GROOVY-12593?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18137312#comment-18137312
]
ASF GitHub Bot commented on GROOVY-12593:
-----------------------------------------
testlens-app[bot] commented on PR #3120:
URL: https://github.com/apache/groovy/pull/3120#issuecomment-6607891507
## 🚨 All tests passed but jobs failed 🚨
### Failed Jobs without Test Failures
❌ [Build and test / lts \(21,
ubuntu-latest\)](https://github.com/apache/groovy/actions/runs/41660166071/job/126000951471?pr=3120)
🏷️ Commit: d8817bf0e48adaf94ec75356acec732e5861749b
▶️ Tests: 37928 executed
🟡 Checks: 8/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/)._
> Assigning a static trait property named name, module, componentType or
> packageName from a static trait method fails
> -------------------------------------------------------------------------------------------------------------------
>
> Key: GROOVY-12593
> URL: https://issues.apache.org/jira/browse/GROOVY-12593
> Project: Groovy
> Issue Type: Bug
> Affects Versions: 4.0.33, 5.0.8, 6.0.0
> Reporter: Scott Murphy Heiberg
> Priority: Major
>
> {code:groovy}
> trait T {
> static String name = 'x'
> static void w() { name = 'y' } // same with this.name = 'y', name += 'y',
> or inside a closure or lambda
> }
> class C implements T {}
> C.w()
> assert C.name == 'y'
> {code}
> Actual (dynamic):
> {noformat}
> groovy.lang.MissingMethodException: No signature of static method:
> java_lang_Object__name$set for class: C is applicable for argument types:
> (String) values: [y]
> {noformat}
> Actual (@TypeChecked or @CompileStatic):
> {noformat}
> [Static type checking] - Cannot find matching method
> java.lang.Class#java_lang_Object__name$set(java.lang.String) or static method
> T#java_lang_Object__name$set(java.lang.String). Please check if the declared
> type is correct and if the method exists.
> {noformat}
> Expected: the assignment sets the static property, as it does for any other
> property name. The same happens for {{module}}, {{componentType}} and
> {{packageName}}. Reads, and assignments from instance trait methods, work.
> Cause: in a static trait method the receiver is typed as Class of T, and
> {{TraitReceiverTransformer.tryGetFieldNode}} looked the field up on that type
> before the trait. It found the private field of {{java.lang.Class}} with that
> name, so the transformer generated a call to a setter named after {{Object}}.
> Seen in 4.0.33, 5.0.8 and 6.0.0 (dynamic).
> PR: https://github.com/apache/groovy/pull/3120
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)