Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
1.6
-
None
-
None
Description
If you use the @Delegate to mark a Map as a Delegate you'll get an error:
java.lang.NullPointerException: Cannot invoke method put() on null object
It can be illustrated with this example:
class Test {
@Delegate Map mp
}
def t = new Test(mp: new HashMap())
println t.keySet()
I originally noticed it when trying it with a GroovyRowResult (same error as above):
import groovy.sql.GroovyRowResult
class DelegateRowResult {
@Delegate GroovyRowResult row
String foo
}
DelegateRowResult d = new DelegateRowResult( foo: "Boo")
println "$d.foo"