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

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

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

   ## ✅ All tests passed ✅
   
   🏷️ Commit: 11a776b0ba2cc189d577c405dfecc9323ba196dc
   ▶️ Tests:  90592 executed
   ⚪️ Checks: 31/31 completed
   
   ---
   _Learn more about TestLens at [testlens.app](https://testlens.app)._
   




> Unqualified super.m(...) from a static trait method throws 
> MissingMethodException — should be a compile error or walk the trait chain
> -------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: GROOVY-12105
>                 URL: https://issues.apache.org/jira/browse/GROOVY-12105
>             Project: Groovy
>          Issue Type: Bug
>            Reporter: Paul King
>            Assignee: Paul King
>            Priority: Major
>
> Inside a trait STATIC method, an unqualified `super.m(...)` call does
> not walk the trait chain documented for the instance-method case
> (GEP-22 § "this, super, and stackable traits" item 2). The call
> compiles successfully but throws MissingMethodException at runtime.
> Minimal reproducer:
> {code:groovy}
> trait Base { static String m() { 'Base' } }
> trait V extends Base {
>     static String m() { 'V' }
>     static callSuper() { super.m() }   // unqualified, from static
> }
> class Impl implements V { }
> Impl.callSuper()
> {code}
> Expected: either resolve to Base.m (matching the spec's "walks the
> trait chain" semantic for the instance case) or reject at compile
> time as an unsupported construct.
> Actual (consistent across 4.0.32, 5.0.6, 6.0.0-alpha-1):
>     java.lang.MissingMethodException: No signature of method:
>     static Base.m() is applicable for argument types: () values: []
> Contrast: the instance-method version of the same shape
> (without `static`) works as the spec documents — returns 'Base'.
> Plain Java/Groovy `super.m()` for class statics works normally
> (returns the parent class's m()), so the limitation is specific to
> trait static methods.
> *Recommended fix*: either implement the trait-chain walk for statics
> (symmetric with the instance-method case), or reject at compile time
> with a clear error pointing to `T.super.m(...)` as the explicit form.
> The latter is simpler and matches the recommendation in the GEP-22 v5
> draft (§ "this, super, and stackable traits" item 4, already drafted
> as part of the GEP-22 PR companion to this ticket).
> *Test coverage*: row 15 in
> src/test/groovy/org/codehaus/groovy/transform/traitx/TraitStaticDispatchMatrix.groovy
> is currently @NotYetImplemented asserting the compile-error
> end-state; will flip red when this ticket is resolved.
> *Related*: GROOVY-11985, GROOVY-12093, JIRA #1 (T.this in trait body).
> Both surfaced during empirical sweep for Grails alternatives.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to