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

Can't pass this in super()

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • None
    • 1.0-JSR-2
    • class generator
    • None

    Description

      When I invoke the super constructor of a parent class, I cannot pass "this":

      B.groovy:

      class B {
      B {}
      }

      C.groovy:

      class C extends B {
      C()

      { super(this) }

      static void main(args)

      { cc = new C() }

      }

      I get this failure:

      Exception in thread "main" java.lang.VerifyError: (class: C, method: <init> signature: ()V) Expecting to find object/array on stack
      at java.lang.Class.getDeclaredConstructors0(Native Method)
      at java.lang.Class.privateGetDeclaredConstructors(Class.java:1610)
      at java.lang.Class.getDeclaredConstructors(Class.java:1169)
      at groovy.lang.MetaClass.<init>(Unknown Source)
      at groovy.lang.MetaClassRegistry.getMetaClass(MetaClassRegistry.java:100)
      at org.codehaus.groovy.runtime.Invoker.invokeMethod(Unknown Source)
      at org.codehaus.groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.java:106)
      at groovy.lang.GroovyShell.run(GroovyShell.java:222)
      at groovy.lang.GroovyShell.main(GroovyShell.java:92)
      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:474)

      If I change the "this" to something else, it works.

      Attachments

        Activity

          People

            blackdrag Jochen Theodorou
            johnstump John Stump
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: