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

inherited invokeMethod does not work

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.0-beta-4
    • 1.0-beta-4
    • None
    • None
    • linux, jdk 1.4.2, groovy 1.0-beta3 libraries, except for groovy-1.0*.jar, which I build from the CVS head today (3/3/2004)

    Description

      this groovy file fails on the last line. 'new A().duh()' works, but 'new B().duh()' does not work.

      === here is the file ===

      class A {
      invokeMethod(String name, Object args) {
      try

      { metaClass.invokeMethod(this, name, args) }

      catch(MissingMethodException e) {
      println "Missing method: ${name}"
      }
      }
      }
      class B extends A {
      }

      new A().duh()
      new B().duh()

      === here is the error ===

      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at groovy.lang.MetaClass.doMethodInvoke(MetaClass.java:765)
      at groovy.lang.MetaClass.invokeMethod(MetaClass.java:214)
      at org.codehaus.groovy.runtime.Invoker.invokeMethod(Invoker.java:130)
      at org.codehaus.groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.java:98)
      at B.invokeMethod(b.groovy)
      at org.codehaus.groovy.runtime.Invoker.invokeMethod(Invoker.java:117)
      at org.codehaus.groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.java:98)
      at b.run(b.groovy:13)
      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:324)
      at groovy.lang.MetaClass.doMethodInvoke(MetaClass.java:765)
      at groovy.lang.MetaClass.invokeMethod(MetaClass.java:214)
      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:324)
      at groovy.lang.MetaClass.doMethodInvoke(MetaClass.java:765)
      at groovy.lang.MetaClass.invokeMethod(MetaClass.java:214)
      at org.codehaus.groovy.runtime.Invoker.invokeMethod(Invoker.java:130)
      at org.codehaus.groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.java:98)
      at b.invokeMethod(b.groovy)
      at org.codehaus.groovy.runtime.Invoker.invokeMethod(Invoker.java:117)
      at org.codehaus.groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.java:98)
      at org.codehaus.groovy.runtime.InvokerHelper.runScript(InvokerHelper.java:311)
      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:324)
      at groovy.lang.MetaClass.doMethodInvoke(MetaClass.java:765)
      at groovy.lang.MetaClass.invokeStaticMethod(MetaClass.java:279)
      at org.codehaus.groovy.runtime.Invoker.invokeMethod(Invoker.java:124)
      at org.codehaus.groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.java:98)
      at b.main(b.groovy)
      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:324)
      at groovy.lang.MetaClass.doMethodInvoke(MetaClass.java:765)
      at groovy.lang.MetaClass.invokeStaticMethod(MetaClass.java:279)
      at org.codehaus.groovy.runtime.Invoker.invokeMethod(Invoker.java:124)
      at org.codehaus.groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.java:98)
      at groovy.lang.GroovyShell.run(GroovyShell.java:171)
      at groovy.lang.GroovyShell.main(GroovyShell.java:85)
      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:324)
      at org.codehaus.classworlds.Launcher.launchStandard(Launcher.java:410)
      at org.codehaus.classworlds.Launcher.launch(Launcher.java:344)
      at org.codehaus.classworlds.Launcher.main(Launcher.java:461)

      Attachments

        Activity

          People

            Unassigned Unassigned
            wburdick Bill Burdick
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: