views:

165

answers:

2

I'm coding a small test app in Groovy. I have the following code.

class Address {

static constraints = {
    street(blank:false, maxSize:100)
    residencenumber(min:1, max:65000)
    addition()
    zip()
    city(blank:false, maxSize:100)
    county()
    country(blank:false, maxSize:50)
}

String street
String zip
int residencenumber
String addition
String city
String county
String country

String toString() {
 return street + " " + residencenumber + " " + zip + " " + city + " " + country
}

}

I'm getting this rather cryptic message.

nojevive@follett:~/dev/code/mysmallapp$ grails generate-all Address Welcome to Grails 1.1.1 - http://grails.org/ Licensed under Apache Standard License 2.0 Grails home is set to: /home/nojevive/dev/grails

Base Directory: /home/nojevive/dev/code/mysmallapp Running script /home/nojevive/dev/grails/scripts/GenerateAll.groovy Environment set to development groovy.lang.MissingMethodException: No signature of method: java.lang.Integer.call() is applicable for argument types: () values: [] at Project$__clinit__closure1.doCall(Project.groovy:11) at Project$__clinit__closure1.doCall(Project.groovy) at Project.getProperty(Project.groovy) at _PluginDependencies_groovy$_run_closure6_closure53.doCall(_PluginDependencies_groovy:467) at _PluginDependencies_groovy$_run_closure6_closure53.doCall(_PluginDependencies_groovy) at _GrailsSettings_groovy$_run_closure10.doCall(_GrailsSettings_groovy:274) at _GrailsSettings_groovy$_run_closure10.call(_GrailsSettings_groovy) at _PluginDependencies_groovy$_run_closure6.doCall(_PluginDependencies_groovy:447) at _GrailsBootstrap_groovy$_run_closure1.doCall(_GrailsBootstrap_groovy:74) at _GrailsGenerate_groovy$_run_closure1.doCall(_GrailsGenerate_groovy:37) at GenerateAll$_run_closure1.doCall(GenerateAll.groovy:42) at gant.Gant$_dispatch_closure4.doCall(Gant.groovy:324) at gant.Gant$_dispatch_closure6.doCall(Gant.groovy:334) at gant.Gant$_dispatch_closure6.doCall(Gant.groovy) at gant.Gant.withBuildListeners(Gant.groovy:344) at gant.Gant.this$2$withBuildListeners(Gant.groovy) at gant.Gant$this$2$withBuildListeners.callCurrent(Unknown Source) at gant.Gant.dispatch(Gant.groovy:334) at gant.Gant.this$2$dispatch(Gant.groovy) at gant.Gant.invokeMethod(Gant.groovy) at gant.Gant.processTargets(Gant.groovy:495) at gant.Gant.processTargets(Gant.groovy:480) Error loading plugin manager: No signature of method: java.lang.Integer.call() is applicable for argument types: () values: []

First I thought maybe my number was out of range (I had 1000000). Then I thought maybe the number was a built-in name so I renamed to residencenumber. But no luck. What am I missing here? I now removed all constraints, but still same message. So it has nothing to do with the fields I guess. Something must be broken?

A: 

I might be wrong but I think you're adding int to String. I Try:

street + " " + residencenumber.toString() +...
wuub
I tried that already, I chopped off everything after 'street', but to no avail.
nojevive
yeah, it was a long shot.
wuub
A: 

I know you have this solved, but a nicer way of doing the toString is:

String toString() {
  "$street $residencenumber $zip $city $country"
}
tim_yates
thanks for the tip.
nojevive