Index: src/main/org/codehaus/groovy/antlr/AntlrParserPlugin.java =================================================================== --- src/main/org/codehaus/groovy/antlr/AntlrParserPlugin.java (revision 20068) +++ src/main/org/codehaus/groovy/antlr/AntlrParserPlugin.java (revision ) @@ -2929,6 +2949,11 @@ "Class definition not expected here. Possible attempt to use inner class. " + "Inner classes not supported, perhaps try using a closure instead."); } + if (node.getType() == METHOD_DEF) { + throw new ASTRuntimeException(node, + "Found a method definition when expecting an expression. Possible attempt to define a method " + + "inside a closure? Define the method outside or use an inner closure."); + } throw new ASTRuntimeException(node, "Unknown type: " + getTokenName(node)); }