groovy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jwagenleit...@apache.org
Subject [2/2] groovy git commit: GROOVY-7580 - ExpandoMetaClass append method does not throw an exception as per docs
Date Wed, 06 Apr 2016 01:23:07 GMT
GROOVY-7580 - ExpandoMetaClass append method does not throw an exception as per docs

Added clarification that only public methods declared by the class or interface with the same
name and parameter types would cause the append to throw an Exception.  Methods added to the
metaClass at runtime will be replaced by the left shift operator.


Project: http://git-wip-us.apache.org/repos/asf/groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/6275843d
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/6275843d
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/6275843d

Branch: refs/heads/GROOVY_2_4_X
Commit: 6275843d33e462a50e1264f35ac722569453b29b
Parents: 6d360f6
Author: John Wagenleitner <jwagenleitner@apache.org>
Authored: Tue Apr 5 18:15:30 2016 -0700
Committer: John Wagenleitner <jwagenleitner@apache.org>
Committed: Tue Apr 5 18:21:25 2016 -0700

----------------------------------------------------------------------
 src/spec/doc/core-metaprogramming.adoc | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/6275843d/src/spec/doc/core-metaprogramming.adoc
----------------------------------------------------------------------
diff --git a/src/spec/doc/core-metaprogramming.adoc b/src/spec/doc/core-metaprogramming.adoc
index d2ce332..57f807e 100644
--- a/src/spec/doc/core-metaprogramming.adoc
+++ b/src/spec/doc/core-metaprogramming.adoc
@@ -381,8 +381,10 @@ Once the `ExpandoMetaClass` is accessed by calling the `metaClass` property,
met
 `<<` or the `=` operator.
 
 [NOTE]
-Note that the left shift operator is used to _append_ a new method. If the method already
exists
-an exception will be thrown. If you want to _replace_ a method you can use the `=` operator.
+Note that the left shift operator is used to _append_ a new method. If a public method with
the same name and
+parameter types is declared by the class or interface, including those inherited from superclasses
and superinterfaces
+but excluding those added to the `metaClass` at runtime, an exception will be thrown. If
you want to _replace_ a
+method declared by the class or interface you can use the `=` operator.
 
 The operators are applied on a non-existent property of `metaClass` passing an instance of
a `Closure` code block.
 


Mime
View raw message