You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Eric Milles (Jira)" <ji...@apache.org> on 2020/08/05 17:08:00 UTC

[jira] [Commented] (GROOVY-9672) trait conflict resolution not available for static methods

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

Eric Milles commented on GROOVY-9672:
-------------------------------------

{{SuperCallTraitTransformer#transformMethodCallExpression(MethodCallExpression)}} adds "this" parameter, which causes problems for static method calls.

> trait conflict resolution not available for static methods
> ----------------------------------------------------------
>
>                 Key: GROOVY-9672
>                 URL: https://issues.apache.org/jira/browse/GROOVY-9672
>             Project: Groovy
>          Issue Type: Bug
>            Reporter: Eric Milles
>            Priority: Minor
>
> If the case mentioned in https://docs.groovy-lang.org/latest/html/documentation/#_default_conflict_resolution used static methods instead of instance methods, "T.super.m()" disambiguation is not available.
> Consider the following:
> {code:groovy}
> trait A {
>   static m() { 'A' }
> }
> trait B {
>   static m() { 'B' }
> }
> class C implements A, B {
>   void test() {
>     print m() // prints "B"
>     print A.super.m() // java.lang.IllegalArgumentException or some other compiler problem
>     print B.super.m() // java.lang.IllegalArgumentException or some other compiler problem
>   }
> }
> new C().test()​
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)