You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by su...@apache.org on 2017/04/07 13:31:30 UTC
[47/50] [abbrv] groovy git commit: GROOVY-8140: Invoke method not
returning MOP super method if isCallToSuper (closes #520)
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/b2d95c2b
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/b2d95c2b
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/b2d95c2b
Branch: refs/heads/parrot
Commit: b2d95c2bcacb9c5473ea7f008ed3f5392717a6f0
Parents: 752341d
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:14:57 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/b2d95c2b/src/main/groovy/lang/MetaClassImpl.java
----------------------------------------------------------------------
diff --git a/src/main/groovy/lang/MetaClassImpl.java b/src/main/groovy/lang/MetaClassImpl.java
index 93c013b..a059a4f 100644
--- a/src/main/groovy/lang/MetaClassImpl.java
+++ b/src/main/groovy/lang/MetaClassImpl.java
@@ -493,11 +493,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/b2d95c2b/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/
+ '''
+ }
+
+}