groovy Traits Multiple inheritance problem


Class can implement multiple traits. In case if one trait defines method with the same signature like another trait, there is a multiple inheritance problem. In that case the method from last declared trait is used:

trait Foo {
  def hello() {'Foo'}
trait Bar {
  def hello() {'Bar'}

class FooBar implements Foo, Bar {}

assert new FooBar().hello() == 'Bar'