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

VerifyError for class definition in script edge case

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 1.5.7, 1.6-beta-2
    • 1.6.3, 1.7-beta-1
    • bytecode
    • None

    Description

      This script runs fine:

      class MyClosure extends Closure {
          MyClosure(owner) {
              super(owner)
          }
          void run() { println 'running' }
      }
      new MyClosure(this).run()
      

      But when I run this script:

      class MyClosure extends Closure {
          MyClosure() {
              super(this)
          }
          void run() { println 'running' }
      }
      new MyClosure().run()
      

      I receive:

      java.lang.VerifyError: (class: MyClosure, method: <init> signature: ()V)
      Expecting to find object/array on stack
      

      Perhaps accessing the this variable inside the class definintion isn't supported by current scoping rules but in any case we should get a nice error not VerifyError.

      Attachments

        Activity

          People

            roshandawrani Roshan Dawrani
            paulk Paul King
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: