You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Aseem Bansal (JIRA)" <ji...@apache.org> on 2015/09/04 22:00:46 UTC

[jira] [Created] (GROOVY-7580) ExpandoMetaClass append method does not throw an exception as per docs

Aseem Bansal created GROOVY-7580:
------------------------------------

             Summary: ExpandoMetaClass append method does not throw an exception as per docs
                 Key: GROOVY-7580
                 URL: https://issues.apache.org/jira/browse/GROOVY-7580
             Project: Groovy
          Issue Type: Bug
            Reporter: Aseem Bansal


I was reading the docs when I came across "Note that the left shift operator is used to append a new method. If the method already exists an exception will be thrown."

I decided to try it via the below program. There was no exception. I am using groovy 2.3.8

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

class B extends A {
}
B.metaClass.hello << {
  "hello subclass"
}

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

new B().hello()
{noformat}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)