groovy-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Anto Aravinth <anto.aravinth....@gmail.com>
Subject Expando Metaclass doesnt throw error on duplicate method
Date Wed, 16 Sep 2015 06:55:11 GMT
Hi all,

I have this code:

class A {
}

A.metaClass.hello = {
  "hello superclass"
}

class B extends A {
}

B.metaClass.hello << {
  "hello subclass"
}

B.metaClass.hello << {
  "hello subclass"
}

new B().hello()

As you can see I could able to define hello method twice. But doc says it
will throw an exception if it sees a method if already present.

Groovy version : 2.2

Mime
View raw message