Grails 3.x- GORM - inList fails on members start with underscore (_)

133 Views Asked by At

I have this class

class ScanRequest4Command implements Validateable {

    String _ScanType

    static constraints = {
        pScanType inList:["a", "b"]
    }
}

this code worked fine in grails 2.4.4 lately, we started upgrading to grails 3.1.16

now when I try to run the code if fails and throw the following exception:

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)

which did not help much. if I remove the inList constraint the code passes, meaning the problem is in the inList constraint.

so after test-and-failed, I found out the if I change the member's name to pScanType the code passes.

so my question is this:

is the underscore not allowed in member name prefix? if so is it documented anywhere? if not then what is the problem with the code?

0

There are 0 best solutions below