Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
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
}
}
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) {