gpt4 book ai didi

groovy - 在编译Groovy类时遇到奇怪的stacktrace

转载 作者:行者123 更新时间:2023-12-02 10:55:47 25 4
gpt4 key购买 nike

我正在用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生成所有地址
欢迎使用Grails 1.1.1- http://grails.org/
根据Apache Standard License 2.0许可
Grails主目录设置为:/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)。然后我以为该号码是内置名称,因此我将其重命名为Residencenumber。但是没有运气。我在这里想念什么?
我现在删除了所有约束,但仍然是相同的消息。因此,这与我猜想的 Realm 无关。一定要弄坏东西吗?

最佳答案

我知道您已经解决了这个问题,但是执行toString的更好方法是:

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

关于groovy - 在编译Groovy类时遇到奇怪的stacktrace,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1127782/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com