Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-4215

exception trying to define method in closure

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 1.8-rc-4, 1.7.11
    • None
    • None

    Description

      {->
          def say(String msg) {
            println(msg)
          }
      }()
      

      throws:

      1 compilation error:
      
      Unknown type: METHOD_DEF at line: 2 column: 5. File: predef.groovy at Exception in thread "AWT-EventQueue-0" 
      groovy.lang.MissingPropertyException: No such property: column for class: org.codehaus.groovy.antlr.ASTParserException
      	at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:49)
      	at org.codehaus.groovy.runtime.callsite.GetEffectivePojoPropertySite.getProperty(GetEffectivePojoPropertySite.java:63)
      	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGetProperty(AbstractCallSite.java:237)
      	at groovy.ui.Console$_finishException_closure9.doCall(Console.groovy:636)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      	at java.lang.reflect.Method.invoke(Method.java:597)
      	at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:88)
      	at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)
      	at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:272)
      	at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:886)
      	at groovy.lang.Closure.call(Closure.java:276)
      	at groovy.lang.Closure.call(Closure.java:289)
      	at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:1176)
      	at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:1152)
      	at org.codehaus.groovy.runtime.dgm$111.invoke(Unknown Source)
      	at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoMetaMethodSiteNoUnwrapNoCoerce.invoke(PojoMetaMethodSite.java:270)
      	at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite.java:52)
      	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)
      	at groovy.ui.Console.finishException(Console.groovy:619)
      	at sun.reflect.GeneratedMethodAccessor441.invoke(Unknown Source)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      	at java.lang.reflect.Method.invoke(Method.java:597)
      	at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:88)
      	at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)
      	at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:361)
      	at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:886)
      	at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(PogoMetaClassSite.java:66)
      	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:151)
      	at groovy.ui.Console$_runScriptImpl_closure16_closure29.doCall(Console.groovy:868)
      	at sun.reflect.GeneratedMethodAccessor655.invoke(Unknown Source)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      	at java.lang.reflect.Method.invoke(Method.java:597)
      	at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:88)
      	at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)
      	at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:272)
      	at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:886)
      	at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(PogoMetaClassSite.java:66)
      	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:151)
      	at groovy.ui.Console$_runScriptImpl_closure16_closure29.doCall(Console.groovy)
      	at sun.reflect.GeneratedMethodAccessor654.invoke(Unknown Source)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      	at java.lang.reflect.Method.invoke(Method.java:597)
      	at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:88)
      	at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)
      	at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:272)
      	at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:886)
      	at groovy.lang.Closure.call(Closure.java:276)
      	at groovy.lang.Closure.call(Closure.java:271)
      	at groovy.lang.Closure.run(Closure.java:354)
      	at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
      	at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
      	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
      	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
      	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
      	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
      	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
      	at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
      

      Attachments

        Activity

          People

            paulk Paul King
            ittayd Ittay Dror
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: