Index: src/main/org/codehaus/groovy/classgen/AsmClassGenerator.java =================================================================== --- src/main/org/codehaus/groovy/classgen/AsmClassGenerator.java (revision 18661) +++ src/main/org/codehaus/groovy/classgen/AsmClassGenerator.java (working copy) @@ -518,15 +518,15 @@ /** * method to determine if a method is a MOP method. This is done by the - * method name. If the name starts with "this$" or "super$", then it is - * a MOP method + * method name. If the name starts with "this$" or "super$" but does not + * contain "$dist$", then it is an MOP method * * @param methodName name of the method to test * @return true if the method is a MOP method */ public static boolean isMopMethod(String methodName) { - return methodName.startsWith("this$") || - methodName.startsWith("super$"); + return (methodName.startsWith("this$") || + methodName.startsWith("super$")) && !methodName.contains("$dist$"); } protected void visitConstructorOrMethod(MethodNode node, boolean isConstructor) { Index: src/main/org/codehaus/groovy/classgen/Verifier.java =================================================================== --- src/main/org/codehaus/groovy/classgen/Verifier.java (revision 18654) +++ src/main/org/codehaus/groovy/classgen/Verifier.java (working copy) @@ -438,6 +438,11 @@ } public void visitMethod(MethodNode node) { + //GROOVY-3712 - if it's an MOP method, it's an error as they aren't supposed to exist before ACG is invoked + if(AsmClassGenerator.isMopMethod(node.getName())) { + throw new RuntimeParserException("Found unexpected MOP methods in the class node for " + classNode.getName() + + "(" + node.getName() + ")", classNode); + } this.methodNode = node; adjustTypesIfStaticMainMethod(node); addReturnIfNeeded(node); Index: src/main/org/codehaus/groovy/transform/DelegateASTTransformation.java =================================================================== --- src/main/org/codehaus/groovy/transform/DelegateASTTransformation.java (revision 18654) +++ src/main/org/codehaus/groovy/transform/DelegateASTTransformation.java (working copy) @@ -125,7 +125,7 @@ private void addDelegateMethod(FieldNode fieldNode, ClassNode owner, Map ownMethods, Map.Entry e, boolean deprecated) { MethodNode method = e.getValue(); - if (!method.isPublic() || method.isStatic()) + if (!method.isPublic() || method.isStatic() || 0 != (method.getModifiers () & Opcodes.ACC_SYNTHETIC)) return; if (!method.getAnnotations(DEPRECATED_TYPE).isEmpty() && !deprecated)