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

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

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

   ## 🚨 All tests passed but jobs failed 🚨
   
   ### Failed Jobs without Test Failures
   
   ❌ [Build and test / lts \(17, 
macos-latest\)](https://github.com/apache/groovy/actions/runs/41169625197/job/124444557005?pr=3120)
   ❌ [Build and test / lts \(17, 
ubuntu-latest\)](https://github.com/apache/groovy/actions/runs/41169625197/job/124444557105?pr=3120)
   ❌ [Build and test / lts \(17, windows-latest, 
1\)](https://github.com/apache/groovy/actions/runs/41169625197/job/124444557194?pr=3120)
   ❌ [Build and test / lts \(21, 
ubuntu-latest\)](https://github.com/apache/groovy/actions/runs/41169625197/job/124444557107?pr=3120)
   ❌ [Build and test / lts \(25, 
ubuntu-latest\)](https://github.com/apache/groovy/actions/runs/41169625197/job/124444557153?pr=3120)
   
   🏷️ Commit: 0658c60e30fbb7fca28514a435f788561eaec17c
   ▶️ Tests:  44729 executed
   ⚪️ Checks: 26/26 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)

Reply via email to