我有这个班级
class ScanRequest4Command implements Validateable {
String _ScanType
static constraints = {
pScanType inList:["a", "b"]
}
}
此代码在grails 2.4.4中运行良好 最近,我们开始升级到grails 3.1.16
现在当我尝试运行代码失败并抛出以下异常时:
java.lang.IllegalArgumentException: object is not an instance of declaring class
at com.evercompliant.commands.v4.ScanRequest4Command$__clinit__closure9.doCall(ScanRequest4Command.groovy:151)
at com.evercompliant.commands.v4.ScanRequest4Command$__clinit__closure9.doCall(ScanRequest4Command.groovy)
at com.evercompliant.commands.v4.ScanRequest4Command$__clinit__closure9.call(ScanRequest4Command.groovy)
at com.evercompliant.commands.v4.ScanRequest4Command$__clinit__closure9.call(ScanRequest4Command.groovy)
at com.evercompliant.commands.v4.ScanRequest4Command.validate(ScanRequest4Command.groovy)
at com.evercompliant.commands.v4.ScanRequest4Command.validate(ScanRequest4Command.groovy)
at com.evercompliant.commands.v4.Base4Command.validateWithErrors(Base4Command.groovy:98)
at com.evercompliant.commands.v4.PortfolioManagementBase4Command.validateWithErrors(PortfolioManagementBase4Command.groovy)
at com.evercompliant.commands.v4.ScanRequest4Command.super$2$validateWithErrors(ScanRequest4Command.groovy)
at com.evercompliant.commands.v4.ScanRequest4Command.validateWithErrors(ScanRequest4Command.groovy:164)
at com.evercompliant.commands.v4.ScanRequest4Command$validateWithErrors.call(Unknown Source)
at com.evercompliant.data.Merchant.withTransaction(Merchant.groovy)
at com.evercompliant.data.Merchant$withTransaction.call(Unknown Source)
at com.evercompliant.utils.CorsFilter.doFilterInternal(CorsFilter.java:35)
没有多大帮助。
如果我删除代码传递的inList
约束,意味着问题出现在inList
约束中。
所以在测试失败之后,我发现如果我将成员的名字改为代码通过的pScanType
。
所以我的问题是:
是成员名称前缀中不允许的下划线?如果是这样的话 记录在哪里?如果不是那么代码有什么问题?