Index: src/test/gls/generics/GenericsTestBase.java
===================================================================
--- src/test/gls/generics/GenericsTestBase.java	(revision 15983)
+++ src/test/gls/generics/GenericsTestBase.java	(revision )
@@ -85,7 +85,7 @@
         return signatures;
     }
     
-    void shouldNotCompile(String script) {
+    protected void shouldNotCompile(String script) {
         try {
             loader.parseClass(script);
         } catch (CompilationFailedException cfe) {
Index: src/test/groovy/bugs/Groovy4922BugSupport.java
===================================================================
--- src/test/groovy/bugs/Groovy4922BugSupport.java	(revision )
+++ src/test/groovy/bugs/Groovy4922BugSupport.java	(revision )
@@ -0,0 +1,28 @@
+/*
+ * Copyright 2003-2011 the original author or authors.
+ *
+ * Licensed 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;
+
+/**
+ * Support class for GROOVY-4922 bug. Must be written in Java.
+ */
+public class Groovy4922BugSupport {
+    protected String support;
+
+    void someMethod(String value) {
+        support = value;
+    }
+}
Index: src/test/groovy/bugs/Groovy4922BugChild.groovy
===================================================================
--- src/test/groovy/bugs/Groovy4922BugChild.groovy	(revision )
+++ src/test/groovy/bugs/Groovy4922BugChild.groovy	(revision )
@@ -0,0 +1,35 @@
+package groovy.bugs
+
+/*
+ * Copyright 2003-2011 the original author or authors.
+ *
+ * Licensed 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.
+ */
+
+import groovy.bugs.Groovy4922BugSupport
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: cedric
+ * Date: 18/07/11
+ * Time: 18:20
+ */
+
+/**
+ * Child class to test GROOVY-4922.
+ */
+class Groovy4922BugChild extends Groovy4922BugSupport {
+    protected void someMethod(String parameter) {
+        super.someMethod(parameter)
+    }
+}
Index: src/main/groovy/lang/MetaClassImpl.java
===================================================================
--- src/main/groovy/lang/MetaClassImpl.java	(revision 21606)
+++ src/main/groovy/lang/MetaClassImpl.java	(revision )
@@ -444,6 +444,11 @@
                 return !useThis && clazz == theCachedClass;
             }
 
+            private boolean checkOverride(MetaMethod method) {
+                return (useThis ^ (method.getModifiers() & (Modifier.PUBLIC | Modifier.PROTECTED)) == 0) &&
+                                !(method.getModifiers()==0);
+            }
+
             public void methodNameAction(Class clazz, MetaMethodIndex.Entry e) {
                 if (useThis) {
                     if (e.methods == null)
@@ -488,7 +493,7 @@
                         MetaMethod method = (MetaMethod) e.methodsForSuper;
                         if (method instanceof NewMetaMethod)
                           return;
-                        if (useThis ^ (method.getModifiers() & (Modifier.PUBLIC | Modifier.PROTECTED)) == 0)
+                        if (checkOverride(method))
                           return;
                         String mopName = method.getMopName();
                         int index = Arrays.binarySearch(mopMethods, mopName, CachedClass.CachedMethodComparatorWithString.INSTANCE);
Index: src/test/groovy/bugs/Groovy4922Bug.groovy
===================================================================
--- src/test/groovy/bugs/Groovy4922Bug.groovy	(revision )
+++ src/test/groovy/bugs/Groovy4922Bug.groovy	(revision )
@@ -0,0 +1,27 @@
+/*
+ * Copyright 2003-2011 the original author or authors.
+ *
+ * Licensed 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 Groovy4922Bug extends GroovyTestCase {
+    void testShouldNotThrowStackOverflow() {
+        def child = new Groovy4922BugChild()
+        child.someMethod("value")
+        assert child.support == "value"
+    }
+}
+
Index: src/main/groovy/lang/MetaMethod.java
===================================================================
--- src/main/groovy/lang/MetaMethod.java	(revision 20965)
+++ src/main/groovy/lang/MetaMethod.java	(revision )
@@ -196,7 +196,7 @@
         if (mopName == null) {
           String name = getName();
           CachedClass declaringClass = getDeclaringClass();
-          if ((getModifiers() & (Modifier.PUBLIC| Modifier.PROTECTED)) == 0)
+          if (getModifiers()>0 && (getModifiers() & (Modifier.PUBLIC| Modifier.PROTECTED)) == 0)
             mopName = new StringBuffer().append("this$").append(declaringClass.getSuperClassDistance()).append("$").append(name).toString();
           else
             mopName = new StringBuffer().append("super$").append(declaringClass.getSuperClassDistance()).append("$").append(name).toString();
Index: src/main/org/codehaus/groovy/classgen/asm/MopWriter.java
===================================================================
--- src/main/org/codehaus/groovy/classgen/asm/MopWriter.java	(revision 20965)
+++ src/main/org/codehaus/groovy/classgen/asm/MopWriter.java	(revision )
@@ -86,7 +86,8 @@
             // no this$ methods for protected/public isThis=true
             // super$ method for protected/public isThis=false
             // --> results in XOR
-            if (isThis ^ (mn.getModifiers() & (ACC_PUBLIC | ACC_PROTECTED)) == 0) continue;
+            if ((isThis ^ (mn.getModifiers() & (ACC_PUBLIC | ACC_PROTECTED)) == 0) && !(mn.getModifiers()==0))
+                continue;
             String methodName = mn.getName();
             if (isMopMethod(methodName)) {
                 mops.put(new MopKey(methodName, mn.getParameters()), mn);
