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

Expecting to find object/array on stack

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 1.1-beta-1
    • None
    • None
    • Groovy 1.0, sun-jdk-1.6.0

    Description

      I got it down to a few lines of code:

      class Test {
      def mdd = null
      def add_table(table_name, spec, force = false, db = mdd) {
      //def dbb = db
      spec.each

      {c, s -> db.insert_row("DB_MODEL", s) }

      }
      }
      class DB {
      def insert_row(str, data){}
      }
      [db_norms:[table:["type":"T_String50", "nullable": false]]].each{t, d->
      new Test().add_table(t, d, false, new DB())
      }

      You can cut and paste it into the groovyConsole and it fails.

      You can make it work either if you uncomment
      def dbb = db
      and change to
      dbb.insert_row("DB_MODEL", s)

      OR you change
      def add_table(table_name, spec, force = false, db = mdd) {
      to
      def add_table(table_name, spec, force = false, db = null) {

      Attachments

        1. fail.groovy
          0.3 kB
          Uwe Hartl

        Activity

          People

            blackdrag Jochen Theodorou
            uwe.hartl@gmx.net Uwe Hartl
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: