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

Calling static method from subclass using super creates StackOverFlow

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.0.5
    • 2.0.6
    • Compiler
    • None
    • IDEA IC-122.519 EAP using Groovy 2.0.5

    Description

      Don't know whether calling super from a static method is supposed to compile. But it does in IDEA IC-122.519 EAP using Groovy 2.0.5 and runs into an endless loop.

      @CompileStatic
      class A {
          public static foo() {
              print("A")
          }
      }
      
      @CompileStatic
      class B extends A {
          public static foo() {
              A.foo() // compiles and prints "AB"
              super.foo() // compiles and creates StackOverFlow
              print("B")
          }
      
          def static main(args)
          {
              B.foo()
          }
      }
      

      Attachments

        Issue Links

          Activity

            People

              melix Cédric Champeau
              oliver_plow Oliver Plow
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: