[
https://issues.apache.org/jira/browse/GROOVY-12601?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18135645#comment-18135645
]
ASF GitHub Bot commented on GROOVY-12601:
-----------------------------------------
testlens-app[bot] commented on PR #3128:
URL: https://github.com/apache/groovy/pull/3128#issuecomment-6540025219
## 🚨 All tests passed but jobs failed 🚨
### Failed Jobs without Test Failures
❌ [Build and test / lts \(17, windows-latest,
1\)](https://github.com/apache/groovy/actions/runs/41171976632/job/124451678002?pr=3128)
🏷️ Commit: f73565a50f5220ba2b881c6d1499435af446167c
▶️ Tests: 81307 executed
🟡 Checks: 24/25 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/)._
> SC calls the java.lang.Class method instead of a @Virtual trait static method
> of the same name
> ----------------------------------------------------------------------------------------------
>
> Key: GROOVY-12601
> URL: https://issues.apache.org/jira/browse/GROOVY-12601
> Project: Groovy
> Issue Type: Bug
> Affects Versions: 6.0.0
> Reporter: Scott Murphy Heiberg
> Priority: Major
>
> {code:groovy}
> import groovy.transform.Virtual
> @groovy.transform.CompileStatic
> trait T {
> @Virtual static String getName() { 'trait' }
> static String sm() { getName() }
> }
> class C implements T { static String getName() { 'impl' } }
> class D implements T {}
> assert C.sm() == 'impl'
> assert D.sm() == 'trait'
> {code}
> Actual: {{C.sm()}} returns {{'C'}} and {{D.sm()}} returns {{'D'}}. The trait
> calls {{Class.getName()}}. The same happens for other {{Class}} and DGM names
> such as {{getSimpleName}}, {{isInterface}}, {{getModifiers}} and {{dump}}. A
> {{@Virtual static Object cast(Object)}} fails with a {{ClassCastException}}.
> It also happens from instance trait methods and for a {{@Virtual}} static of
> a super trait.
> Expected: {{'impl'}} and {{'trait'}}, as dynamic Groovy and {{@TypeChecked}}
> give.
> The trait transformation rewrites the call to a call on the static self (a
> Class) and marks it for dynamic dispatch. Static type checking finds
> {{Class.getName()}} on that receiver, so the trait type checking extension is
> never asked and static compilation binds the call to the {{Class}} method.
> Seen in 6.0.0 (the first version with @Virtual).
> PR: https://github.com/apache/groovy/pull/3128
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)