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

Calling super.toString() with @TypeChecked or @CompileStatic will throw java.lang.StackOverflowError

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.4.x, 2.5.x
    • Fix Version/s: 2.5.9, 3.0.0-rc-1
    • Component/s: Compiler
    • Labels:
      None
    • Environment:
      Any operating systems running Groovy 2.4.x or 2.5.x

      Description

      The following code snippet will throw java.lang.StackOverflowError:

      import groovy.transform.CompileStatic
      import groovy.transform.TypeChecked
      
      @CompileStatic
      class Super {
        String toString() { 'Super' }
      }
      
      @TypeChecked
      @CompileStatic
      class Child extends Super {
        String toString() { 'Child extends ' + super.toString() }
      }
      
      // java.lang.StackOverflowError will happen
      println new Child().toString()

       

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                daniel_sun Daniel Sun
                Reporter:
                youzhichao Chih Chao Yu
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: