You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by jw...@apache.org on 2017/04/05 02:11:06 UTC

groovy git commit: GROOVY-8140: Invoke method not returning MOP super method if isCallToSuper (closes #520)

Repository: groovy
Updated Branches:
  refs/heads/GROOVY_2_4_X c590bb124 -> 22f327f6f


GROOVY-8140: Invoke method not returning MOP super method if isCallToSuper (closes #520)


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

Branch: refs/heads/GROOVY_2_4_X
Commit: 22f327f6f76be62d67d121e77bcec76751ba69a2
Parents: c590bb1
Author: John Wagenleitner <jw...@apache.org>
Authored: Sun Apr 2 08:34:47 2017 -0700
Committer: John Wagenleitner <jw...@apache.org>
Committed: Tue Apr 4 19:09:29 2017 -0700

----------------------------------------------------------------------
 src/main/groovy/lang/MetaClassImpl.java   |  5 ---
 src/test/groovy/bugs/Groovy8140Bug.groovy | 48 ++++++++++++++++++++++++++
 2 files changed, 48 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/22f327f6/src/main/groovy/lang/MetaClassImpl.java
----------------------------------------------------------------------
diff --git a/src/main/groovy/lang/MetaClassImpl.java b/src/main/groovy/lang/MetaClassImpl.java
index a81909b..b0a5f77 100644
--- a/src/main/groovy/lang/MetaClassImpl.java
+++ b/src/main/groovy/lang/MetaClassImpl.java
@@ -499,11 +499,6 @@ public class MetaClassImpl implements MetaClass, MutableMetaClass {
             boolean useThis;
 
             @Override
-            public boolean skipClass(Class clazz) {
-                return !useThis && clazz == theClass;
-            }
-
-            @Override
             public void methodNameAction(Class clazz, MetaMethodIndex.Entry e) {
                 if (useThis) {
                     if (e.methods == null)

http://git-wip-us.apache.org/repos/asf/groovy/blob/22f327f6/src/test/groovy/bugs/Groovy8140Bug.groovy
----------------------------------------------------------------------
diff --git a/src/test/groovy/bugs/Groovy8140Bug.groovy b/src/test/groovy/bugs/Groovy8140Bug.groovy
new file mode 100644
index 0000000..4de5c88
--- /dev/null
+++ b/src/test/groovy/bugs/Groovy8140Bug.groovy
@@ -0,0 +1,48 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+package groovy.bugs
+
+
+class Groovy8140Bug extends GroovyTestCase {
+
+    void testGetMethodCallToSuperReturnsMOPSuperMethod() {
+        assertScript '''
+            import org.codehaus.groovy.runtime.InvokerHelper
+
+            class A {
+                @Override
+                public String toString() {
+                    return "base"
+                }
+            }
+
+            class B extends A {
+                @Override
+                public String toString() {
+                    return "x" + super.toString()
+                }
+            }
+
+            MetaClass mc = InvokerHelper.getMetaClass(B.class)
+            def method = mc.getMethodWithCaching(B.class, "toString", null, true)
+            assert method.getName() ==~ /super[$]\\d+[$]toString/
+        '''
+    }
+
+}