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

StackOverflowError on super method invocation

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Critical
    • Resolution: Fixed
    • 1.0-RC-1, 1.0-RC-2
    • 1.0
    • None
    • None
    • Fedora Core 6, Java 1.5.0_10, Eclipse 3.2.1, Latest GroovyEclipse built from source

    Description

      super method invocation does not work in the example provided below. The subclass test1() method gets called instead of the superclass test1() method.This is broken in RC2 and RC1 but worked with previous releases.

      Consider the following code:
      A.groovy
      package test
      class A {
      def test()

      { test1() }

      def test1() {
      }
      }

      B.groovy
      package test
      class B extends A {
      static void main(args)

      { new B().test() }

      def test1()

      { super.test1() }

      }

      Here's the execution result:
      Exception in thread "main" java.lang.StackOverflowError
      at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.castToType(ScriptBytecodeAdapter.java:656)
      at test.A.getMetaClass(A.groovy)
      at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnSuperN (ScriptBytecodeAdapter.java:144)
      at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnSuper0(ScriptBytecodeAdapter.java:171)
      at test.B.test1(B.groovy:10)
      at gjdk.test.B_GroovyReflector.invoke (Unknown Source)
      at groovy.lang.MetaMethod.invoke(MetaMethod.java:115)
      at org.codehaus.groovy.runtime.MetaClassHelper.doMethodInvoke(MetaClassHelper.java:713)
      at groovy.lang.MetaClassImpl.invokeMethod (MetaClassImpl.java:560)
      at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnSuperN(ScriptBytecodeAdapter.java:148)
      at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnSuper0(ScriptBytecodeAdapter.java :171)
      at test.B.test1(B.groovy:10)
      ...

      Attachments

        Activity

          People

            blackdrag Jochen Theodorou
            phaze9 Ivo Sele
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: