You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Jochen Theodorou (JIRA)" <ji...@apache.org> on 2015/05/27 10:32:18 UTC
[jira] [Commented] (GROOVY-7436) Multiple inheritance of traits -
conflict resolution
[ https://issues.apache.org/jira/browse/GROOVY-7436?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14560633#comment-14560633 ]
Jochen Theodorou commented on GROOVY-7436:
------------------------------------------
Besides that Scala is doing that, what is your reasoning behind wanting this change? I find the current one more clear. Imagine C is changed to declare the method as well, then in Scala C would be used suddenly. Thus for me the current approach is more robust.
> Multiple inheritance of traits - conflict resolution
> ----------------------------------------------------
>
> Key: GROOVY-7436
> URL: https://issues.apache.org/jira/browse/GROOVY-7436
> Project: Groovy
> Issue Type: Bug
> Reporter: Thornton Chamberlain
>
> {noformat}
> trait A {
> String exec() {'A'}
> }
> trait B implements A {
> String exec() {'B'}
> }
> trait C implements A {
> }
> class X implements A, B, C {}
> def x = new X()
> assert x.exec() == 'B'
> {noformat}
> An equivalent example in Scala will use the exec() implementation from B, as asserted. Groovy will take the implementation from the last declared trait, C, which inherits the implementation from A but does not define its own implementation. I think Groovy should use the implementation from the last declared trait that defines its own implementation.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)