在编译groovy类时获得奇怪的堆栈跟踪

时间:2009-07-14 20:21:47

标签: groovy compiler-errors stack-trace

我正在使用Groovy编写一个小型测试应用程序。我有以下代码。

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
}

}

我收到了这个相当神秘的消息。

nojevive @ follett:〜/ dev / code / mysmallapp $ grails generate-all Address 欢迎来到Grails 1.1.1 - http://grails.org/ 根据Apache Standard License 2.0获得许可 Grails home设置为:/ home / nojevive / dev / grails

基本目录:/ home / nojevive / dev / code / mysmallapp 运行脚本/home/nojevive/dev/grails/scripts/GenerateAll.groovy 环境设定为发展 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: []

首先我想也许我的号码超出范围(我有1000000)。然后我想也许这个数字是一个内置的名字所以我改名为住宅号码。但没有运气。我在这里错过了什么? 我现在删除了所有约束,但仍然是相同的消息。所以它与我猜的领域无关。什么东西必须打破?

2 个答案:

答案 0 :(得分:1)

我知道你已经解决了这个问题,但是做一个更好的toString的方法是:

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

答案 1 :(得分:0)

我可能错了,但我认为你在将String添加到String中。一世 尝试:

street + " " + residencenumber.toString() +...